作者 何书鹏

bug修改

... ... @@ -107,7 +107,6 @@ class PackageOrder extends Base
$pay = new \addons\shopro\library\PayService($payment, $platform, $notify_url);
$result = $pay->create($order_data);
$result = $result->getContent();
return $this->success('获取预付款成功', [
'pay_data' => $result,
... ... @@ -232,7 +231,7 @@ class PackageOrder extends Base
Db::transaction(function () use ($order, $data, $payment, $platform, $pay_fee) {
// 本次购买会员的初始时间
$user = User::get($order['user_id']);
$starttime = $user['vip_time'] > time() ? $user['vip_time'] : time();
$starttime = $user['vip_end_time'] > time() ? $user['vip_end_time'] : time();
$endtime = strtotime('+'.$order['month'].'month',$starttime);
// 修改订单信息
... ... @@ -255,6 +254,13 @@ class PackageOrder extends Base
// 记录 UserCommissionLog
\app\api\model\UserCommissionLog::doAdd($parent_user, $commission, 'package_commission', $order['id'], 1);
}
// 变更会员到期时间
if($user['vip_start_time'] > 0){
$user->vip_start_time = time();
}
$user->vip_end_time = $endtime;
$user->save();
});
return $pay->success()->send();
... ...
... ... @@ -59,7 +59,8 @@ class User extends Base
"store_id": 1,
"avatar_full": "http://www.ant.topshuoshenme", //头像全路径
"is_vip": 1, //是否会员:0=否,1=是
"vip_time": "2021/08/02", //会员到期时间
"vip_start_time": "2020/08/02", //开通会员初始时间
"vip_end_time": "2021/08/02", //会员到期时间
"commission": 0", //待提现佣金
}
})
... ... @@ -67,7 +68,7 @@ class User extends Base
public function index()
{
$auth = \app\common\library\Auth::instance();
$auth->setAllowFields(['id', 'nickname', 'avatar', 'score', 'money','group_id','vip_time','commission']);
$auth->setAllowFields(['id', 'nickname', 'avatar', 'score', 'money','group_id','vip_start_time','vip_end_time','commission']);
$data = $auth->getUserinfo();
if (!isset($data['group'])) {
$data['group'] = \addons\shopro\model\UserGroup::get($data['group_id']);
... ... @@ -88,8 +89,9 @@ class User extends Base
// 头像全路径
$data['avatar_full'] = !empty($data['avatar']) ? cdnurl($data['avatar'],true) : '';
// 是否会员:0=否,1=是
$data['is_vip'] = $data['vip_time'] > time() ? 1 : 0;
$data['vip_time'] = date('Y/m/d',$data['vip_time']);
$data['is_vip'] = $data['vip_end_time'] > time() ? 1 : 0;
$data['vip_start_time'] = date('Y/m/d',$data['vip_start_time']);
$data['vip_end_time'] = date('Y/m/d',$data['vip_end_time']);
$this->success('用户信息', $data);
}
... ...
... ... @@ -1318,7 +1318,8 @@
"store_id": 1,
"avatar_full": "http://www.ant.topshuoshenme", //头像全路径
"is_vip": 1, //是否会员:0=否,1=是
"vip_time": "2021/08/02", //会员到期时间
"vip_start_time": "2020/08/02", //开通会员初始时间
"vip_end_time": "2021/08/02", //会员到期时间
"commission": 0", //待提现佣金
}
}</pre>
... ... @@ -9912,7 +9913,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-12-31 14:28:56 </div>
Generated on 2020-12-31 17:36:14 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">My Website</a>
</div>
... ...