任务功能提交-每日签到功能开发-签到礼物发放
This commit is contained in:
@@ -17,7 +17,7 @@ class Decorate extends Model
|
||||
protected $updateTime = 'updatetime';
|
||||
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
||||
public $TypeArray = [1=>'头像框',12=>'降身卡',2=>'坐骑',9=>'聊天气泡',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号',3=>'麦圈',10=>'CP特效',11=>'CP装扮'];
|
||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼',9=>'爵位购买赠送',10=>'任务奖励'];
|
||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼',9=>'爵位购买赠送',10=>'任务奖励',11=>"每日签到"];
|
||||
public function __construct($data = [])
|
||||
{
|
||||
parent::__construct($data);
|
||||
|
||||
@@ -443,7 +443,7 @@ class Tasks extends Model
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::DAILY_TASKS_REWARD,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::DAILY_TASKS_REWARD));
|
||||
break;
|
||||
case 2: //礼物 方法2:添加到用户礼物背包
|
||||
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::TASK_REWARD,"天降好礼获得礼物");
|
||||
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::TASK_REWARD,"完成任务获得礼物");
|
||||
break;
|
||||
case 3: //坐骑 方法3:添加到用户装扮
|
||||
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||
@@ -614,6 +614,32 @@ class Tasks extends Model
|
||||
'updatetime' => time()
|
||||
]);
|
||||
if ($reslut) {
|
||||
//发放签到礼物
|
||||
$detail_list = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>18])->limit(7)->order('id asc')->select();
|
||||
foreach ($detail_list as $k=>$v){
|
||||
$day = $k+1;
|
||||
if($continuous == $day){
|
||||
switch ($v['type']) {
|
||||
case 1: //金币 方法1:直接添加到用户钱包
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::DAILY_SIGN,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::DAILY_SIGN));
|
||||
break;
|
||||
case 2: //礼物 方法2:添加到用户礼物背包
|
||||
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::DAILY_SIGN,"每日签到获得礼物");
|
||||
break;
|
||||
case 3: //坐骑 方法3:添加到用户装扮
|
||||
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||
if(empty($decorate_price_info)){
|
||||
break;
|
||||
}
|
||||
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],11);
|
||||
break;
|
||||
case 4: //道具 方法5:钻石
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::DAILY_SIGN,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::DAILY_SIGN));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 提交事务
|
||||
Db::commit();
|
||||
return ['code' => 1, 'msg' => '操作成功','data' => null];
|
||||
@@ -632,7 +658,7 @@ class Tasks extends Model
|
||||
*/
|
||||
public function daily_tasks_sign_in_status($user_id){
|
||||
//礼包
|
||||
$detail_list = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>18])->limit(7)->select();
|
||||
$detail_list = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>18])->limit(7)->order('id asc')->select();
|
||||
$list= [];
|
||||
foreach ($detail_list as $k=>$v){
|
||||
$day = $k+1;
|
||||
|
||||
@@ -40,6 +40,8 @@ class UserGiftPack extends Model
|
||||
const NEW_CHARGE_GIFT = 10;
|
||||
//任务奖励
|
||||
const TASK_REWARD = 11;
|
||||
//每日签到
|
||||
const DAILY_SIGN = 12;
|
||||
|
||||
public static function init()
|
||||
{
|
||||
@@ -60,7 +62,8 @@ class UserGiftPack extends Model
|
||||
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得',
|
||||
self::HOUR_RANK_GET => '小时榜获得',
|
||||
self::NEW_CHARGE_GIFT => '新人充值好礼',
|
||||
self::TASK_REWARD => '任务奖励'
|
||||
self::TASK_REWARD => '任务奖励',
|
||||
self::DAILY_SIGN => '每日签到'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,9 @@ class UserWallet extends Model
|
||||
const SIGN_BE_SIGNED_INCOME = 55;
|
||||
//续约
|
||||
const RENEWAL = 56;
|
||||
//每日签到
|
||||
const DAILY_SIGN = 57;
|
||||
|
||||
|
||||
|
||||
//金币支出类型数组
|
||||
@@ -188,7 +191,8 @@ class UserWallet extends Model
|
||||
self::SIGN_MASTER_DAILY_RETURN => '签约师傅每日返还',
|
||||
self::BELIEVER_COMPENSATION => '解约补偿',
|
||||
self::SIGN_BE_SIGNED_INCOME => '被签约者收礼返佣给上级',
|
||||
self::RENEWAL => '续约'
|
||||
self::RENEWAL => '续约',
|
||||
self::DAILY_SIGN => '每日签到'
|
||||
|
||||
];
|
||||
if($type){
|
||||
|
||||
Reference in New Issue
Block a user