任务功能提交-每日签到功能开发-签到礼物发放

This commit is contained in:
2025-12-12 11:38:09 +08:00
parent 68f574b10b
commit fa133911b8
4 changed files with 38 additions and 5 deletions

View File

@@ -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;