提交:原始代码修改
This commit is contained in:
@@ -36,21 +36,29 @@ class Activities extends Model
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($gift_bag_detail as $k=>$v){
|
||||
$gift_id =0;
|
||||
$gift_price = 0;
|
||||
$gift_num = $v['quantity'];
|
||||
switch ($v['type']) {
|
||||
case 1: //金币 方法1:直接添加到用户钱包
|
||||
$gift_price = $v['quantity'];
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE));
|
||||
break;
|
||||
case 2: //礼物 方法2:添加到用户礼物背包
|
||||
$gift_id = $v['foreign_id'];
|
||||
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::FIRST_CHARGE,"首充好礼获得礼物");
|
||||
break;
|
||||
case 3: //坐骑 方法3:添加到用户装扮
|
||||
$gift_id = $v['foreign_id'];
|
||||
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||
if(empty($decorate_price_info)){
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
$gift_price = $decorate_price_info['price'];
|
||||
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],5);
|
||||
break;
|
||||
case 4: //道具 方法5:钻石
|
||||
$gift_price = $v['quantity'];
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE));
|
||||
default:
|
||||
break;
|
||||
@@ -59,15 +67,19 @@ class Activities extends Model
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
// 记录日志
|
||||
//添加礼盒记录
|
||||
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
||||
'user_id' => $user_id,
|
||||
'gift_bag_id' => $gift_bag_id,
|
||||
'gift_id'=> $gift_id,
|
||||
'gift_price' => $gift_price,
|
||||
'num' => $gift_num,
|
||||
'bag_price' => $money,
|
||||
'createtime' => time(),
|
||||
'updatetime' => time()
|
||||
]);
|
||||
}
|
||||
// 记录日志
|
||||
//添加礼盒记录
|
||||
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
||||
'user_id' => $user_id,
|
||||
'gift_bag_id' => $gift_bag_id,
|
||||
'createtime' => time(),
|
||||
'updatetime' => time()
|
||||
]);
|
||||
// 添加活动记录
|
||||
$reslut = Db::name('vs_activities_receive')->insert([
|
||||
'user_id' => $user_id,
|
||||
@@ -111,7 +123,7 @@ class Activities extends Model
|
||||
case 3: //坐骑 方法3:添加到用户装扮
|
||||
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||
if(empty($decorate_price_info)){
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],6);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user