作者 耿培杰

修改接口

... ... @@ -247,4 +247,25 @@ class Sundry extends Api
$data['list'] = explode(',', config('site.recharge'));
$this->success('SUCCESS', $data);
}
/**
* @ApiTitle (获取充值会员金额)
* @ApiSummary (获取充值会员金额)
* @ApiMethod (POST)
* @ApiRoute (/api/sundry/getVipPrice)
* @ApiHeaders (name=token, type=string, required=false, description="请求的Token")
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1553839125",
"data": {
"id": "id",// 地区id
"name": "name",// 名称
},
})
*/
public function getVipPrice()
{
$this->success('SUCCESS', config('site.vip_price'));
}
}
... ...
... ... @@ -30,7 +30,7 @@ class TeamGroup extends Model
$res1 = $this->where(['id'=>['in',$ids]])->update(['status'=>3]);
//修改订单表拼团状态
$res2 = $orderModel->where(['team_group_id'=>['in',$ids]])->update(['team_group_status'=>3]);
$orderList = $orderModel->where(['team_group_id'=>['in',$ids]])->field('order_num,pay_total,pay_type,user_id')->select();
$orderList = $orderModel->where(['team_group_id'=>['in',$ids]])->field('id,order_num,pay_total,pay_type,user_id')->select();
//退款
foreach ($orderList as $k => $orderInfo){
if ($orderInfo['pay_type'] == 1){
... ... @@ -38,7 +38,7 @@ class TeamGroup extends Model
$res3 = $pay->refund($orderInfo['order_num'],$orderInfo['pay_total']);
}else{
//余额退款
$res3 = $userModel->refund($orderInfo['user_id'],$orderInfo['pay_total']);
$res3 = $userModel->refund($orderInfo['user_id'],$orderInfo['pay_total'],$orderInfo['id']);
}
}
if ($res1 && $res2 && $res3){
... ...
... ... @@ -125,8 +125,9 @@ class User extends Model
* @param $total
* @return boolean
*/
public function refund($user_id,$total){
public function refund($user_id,$total,$order_id){
$userMoneyLogModel = new UserMoneyLog();
$orderModel = new Order();
$before = $this->where('id',$user_id)->value('money');
Db::startTrans();
try {
... ... @@ -139,7 +140,8 @@ class User extends Model
];
$res1 = $userMoneyLogModel->save($moneyLogData);
$res2 = $this->where('id',$user_id)->setInc('money',$total);
if ($res1 && $res2){
$res3 = $orderModel->where('id',$order_id)->update(['status'=>3]);
if ($res1 && $res2 && $res3){
Db::commit();
return true;
}else{
... ...
此 diff 太大无法显示。