|
@@ -40,9 +40,9 @@ class AuctionOrder extends BaseModel
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
*/
|
|
- public static function userOrder($data,$uid)
|
|
|
|
|
|
+ public static function userOrder($data, $uid)
|
|
{
|
|
{
|
|
- if ($data['order_id']){
|
|
|
|
|
|
+ if ($data['order_id']) {
|
|
$list = self::alias('a')
|
|
$list = self::alias('a')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id,c.nickname as c_nickname,pay.phone')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id,c.nickname as c_nickname,pay.phone')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
@@ -55,44 +55,44 @@ class AuctionOrder extends BaseModel
|
|
$list['zfb'] = [];
|
|
$list['zfb'] = [];
|
|
$list['bank'] = [];
|
|
$list['bank'] = [];
|
|
$list['time'] = strtotime($list['create_time']);
|
|
$list['time'] = strtotime($list['create_time']);
|
|
- if ($pay){
|
|
|
|
- foreach ($pay as $k => $v){
|
|
|
|
- if ($v['type'] == 1){
|
|
|
|
|
|
+ if ($pay) {
|
|
|
|
+ foreach ($pay as $k => $v) {
|
|
|
|
+ if ($v['type'] == 1) {
|
|
$list['wx'] = $v;
|
|
$list['wx'] = $v;
|
|
- }elseif ($v['type'] == 2){
|
|
|
|
|
|
+ } elseif ($v['type'] == 2) {
|
|
$list['zfb'] = $v;
|
|
$list['zfb'] = $v;
|
|
- }elseif ($v['type'] == 3){
|
|
|
|
|
|
+ } elseif ($v['type'] == 3) {
|
|
$list['bank'] = $v;
|
|
$list['bank'] = $v;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- if ($data['type'] == 1){
|
|
|
|
- $list = self::where([['uid', '=', $uid], ['status', '=', 1]])->page($data['page'], $data['limit'])->select(); //待上传订单
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if ($data['type'] == 1) {
|
|
|
|
+ $list = self::where([['uid', '=', $uid], ['status', '=', 1]])->order('id DESC')->page($data['page'], $data['limit'])->select(); //待上传订单
|
|
|
|
|
|
- }else if($data['type'] == 2){
|
|
|
|
- $list = self::where([['uid', '=', $uid], ['status', '=', 2]])->page($data['page'], $data['limit'])->select(); //待审核订单
|
|
|
|
|
|
+ } else if ($data['type'] == 2) {
|
|
|
|
+ $list = self::where([['uid', '=', $uid], ['status', '=', 2]])->order('id DESC')->page($data['page'], $data['limit'])->select(); //待审核订单
|
|
|
|
|
|
- }else if($data['type'] == 3) {
|
|
|
|
- $list = self::where([['uid', '=', $uid], ['status', '=', 3], ['is_gs', '=', 1]])->page($data['page'], $data['limit'])->select(); //完成订单
|
|
|
|
- }else if($data['type'] == 4) {
|
|
|
|
|
|
+ } else if ($data['type'] == 3) {
|
|
|
|
+ $list = self::where([['uid', '=', $uid], ['status', '=', 3], ['is_gs', '=', 1]])->order('id DESC')->page($data['page'], $data['limit'])->select(); //完成订单
|
|
|
|
+ } else if ($data['type'] == 4) {
|
|
|
|
|
|
$list = AuctionProduct::where([['uid', '=', $uid], ['is_show', '=', 0]])
|
|
$list = AuctionProduct::where([['uid', '=', $uid], ['is_show', '=', 0]])
|
|
->page($data['page'], $data['limit'])
|
|
->page($data['page'], $data['limit'])
|
|
->select();
|
|
->select();
|
|
- if ($list){
|
|
|
|
- foreach ($list as $k => $v){
|
|
|
|
|
|
+ if ($list) {
|
|
|
|
+ foreach ($list as $k => $v) {
|
|
$list[$k]['product_id'] = $v['id'];
|
|
$list[$k]['product_id'] = $v['id'];
|
|
$list[$k]['is_gs'] = 0;
|
|
$list[$k]['is_gs'] = 0;
|
|
$list[$k]['order_id'] = $list[$k]['order'];
|
|
$list[$k]['order_id'] = $list[$k]['order'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- $list = self::where([['uid', '=', $uid]])->page($data['page'], $data['limit'])->select(); //过期订单
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $list = self::where([['uid', '=', $uid]])->order('id DESC')->page($data['page'], $data['limit'])->select(); //过期订单
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- $list = !empty($list)? $list->toArray(): [];
|
|
|
|
|
|
+ $list = !empty($list) ? $list->toArray() : [];
|
|
return $list;
|
|
return $list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -105,24 +105,24 @@ class AuctionOrder extends BaseModel
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
*/
|
|
- public static function seller_list($data,$uid)
|
|
|
|
|
|
+ public static function seller_list($data, $uid)
|
|
{
|
|
{
|
|
- if ($data['order_id']){
|
|
|
|
|
|
+ if ($data['order_id']) {
|
|
$list = self::alias('a')
|
|
$list = self::alias('a')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
->where('a.order_id', $data['order_id'])->find(); //详细订单
|
|
->where('a.order_id', $data['order_id'])->find(); //详细订单
|
|
- }else{
|
|
|
|
- if ($data['type'] == 1){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if ($data['type'] == 1) {
|
|
$status = 1;
|
|
$status = 1;
|
|
- }else if($data['type'] == 2){
|
|
|
|
|
|
+ } else if ($data['type'] == 2) {
|
|
$status = 2;
|
|
$status = 2;
|
|
- }else if($data['type'] == 3) {
|
|
|
|
|
|
+ } else if ($data['type'] == 3) {
|
|
$status = 3;
|
|
$status = 3;
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
$status = 0;
|
|
$status = 0;
|
|
}
|
|
}
|
|
- if ($data['type'] == 4){
|
|
|
|
|
|
+ if ($data['type'] == 4) {
|
|
$product = AuctionTime::alias('a')
|
|
$product = AuctionTime::alias('a')
|
|
->field('FROM_UNIXTIME(a.add_time,"%Y-%m-%d") as gs_time,au.nickname,b.*')
|
|
->field('FROM_UNIXTIME(a.add_time,"%Y-%m-%d") as gs_time,au.nickname,b.*')
|
|
->order('a.id DESC')
|
|
->order('a.id DESC')
|
|
@@ -130,8 +130,8 @@ class AuctionOrder extends BaseModel
|
|
->leftJoin('auction_product b', 'a.product_id = b.id')
|
|
->leftJoin('auction_product b', 'a.product_id = b.id')
|
|
->leftJoin('auction au', 'au.id = a.auction_id')
|
|
->leftJoin('auction au', 'au.id = a.auction_id')
|
|
->select();
|
|
->select();
|
|
- }else{
|
|
|
|
- if ($status == 0){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if ($status == 0) {
|
|
$list = self::alias('a')
|
|
$list = self::alias('a')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
@@ -139,7 +139,7 @@ class AuctionOrder extends BaseModel
|
|
->where([['a.collection_id', '=', $uid]])
|
|
->where([['a.collection_id', '=', $uid]])
|
|
->page($data['page'], $data['limit'])
|
|
->page($data['page'], $data['limit'])
|
|
->select(); //待上传订单
|
|
->select(); //待上传订单
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
$list = self::alias('a')
|
|
$list = self::alias('a')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id')
|
|
->field('a.*,u.nickname,u.avatar,u.uid as user_id')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
->leftJoin('user u', 'a.uid = u.uid')
|
|
@@ -153,15 +153,15 @@ class AuctionOrder extends BaseModel
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ($data['type'] != 4){
|
|
|
|
- $list = !empty($list)? $list->toArray(): [];
|
|
|
|
|
|
+ if ($data['type'] != 4) {
|
|
|
|
+ $list = !empty($list) ? $list->toArray() : [];
|
|
foreach ($list as $k => $v) {
|
|
foreach ($list as $k => $v) {
|
|
$pay = AuctionPay::where('uid', $v['uid'])->find();
|
|
$pay = AuctionPay::where('uid', $v['uid'])->find();
|
|
$list[$k]['phone'] = $pay['phone'];
|
|
$list[$k]['phone'] = $pay['phone'];
|
|
}
|
|
}
|
|
return $list;
|
|
return $list;
|
|
- }else{
|
|
|
|
- $product = empty($product) ? []: $product->toArray();
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $product = empty($product) ? [] : $product->toArray();
|
|
return $product;
|
|
return $product;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -170,7 +170,7 @@ class AuctionOrder extends BaseModel
|
|
|
|
|
|
/**
|
|
/**
|
|
* 卖家操作
|
|
* 卖家操作
|
|
- * @param $id //商品所属人
|
|
|
|
|
|
+ * @param $id //商品所属人
|
|
* @param $price //卖出价格
|
|
* @param $price //卖出价格
|
|
* @param $product //商品详情
|
|
* @param $product //商品详情
|
|
* @return void
|
|
* @return void
|
|
@@ -178,12 +178,12 @@ class AuctionOrder extends BaseModel
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
*/
|
|
- public static function earn($id, $price,$product)
|
|
|
|
|
|
+ public static function earn($id, $price, $product)
|
|
{
|
|
{
|
|
$userModel = new \app\models\user\User();
|
|
$userModel = new \app\models\user\User();
|
|
$productModel = new AuctionProduct();
|
|
$productModel = new AuctionProduct();
|
|
$user = $userModel->find($id);
|
|
$user = $userModel->find($id);
|
|
- if ($user['spread_uid'] > 0){
|
|
|
|
|
|
+ if ($user['spread_uid'] > 0) {
|
|
$s_price = round(($price - $product['price']) * 0.1, 2); // 卖出价格减去购买价格的百分之十 为上级直推奖励
|
|
$s_price = round(($price - $product['price']) * 0.1, 2); // 卖出价格减去购买价格的百分之十 为上级直推奖励
|
|
$spread = $userModel->find($user['spread_uid']);
|
|
$spread = $userModel->find($user['spread_uid']);
|
|
$spread['integral'] = $spread['integral'] + $s_price; //积分增加
|
|
$spread['integral'] = $spread['integral'] + $s_price; //积分增加
|
|
@@ -213,21 +213,22 @@ class AuctionOrder extends BaseModel
|
|
$productModel = new AuctionProduct();
|
|
$productModel = new AuctionProduct();
|
|
$auctionModel = new Auction();
|
|
$auctionModel = new Auction();
|
|
$bookingModel = new AuctionBooking();
|
|
$bookingModel = new AuctionBooking();
|
|
|
|
+ $frozenModel = new AuctionFrozen();
|
|
|
|
|
|
|
|
|
|
$user = $userModel->find($data['uid']);
|
|
$user = $userModel->find($data['uid']);
|
|
- if ($user['is_new'] == 1){
|
|
|
|
|
|
+ if ($user['is_new'] == 1) {
|
|
|
|
|
|
if ($user['spread_uid']) {
|
|
if ($user['spread_uid']) {
|
|
$spread = $userModel->where('uid', $user['spread_uid'])->find();
|
|
$spread = $userModel->where('uid', $user['spread_uid'])->find();
|
|
- if ($spread['green_time'] != strtotime(date('Y-m-d', strtotime('+1 day')))){
|
|
|
|
|
|
+ if ($spread['green_time'] != strtotime(date('Y-m-d', strtotime('+1 day')))) {
|
|
$spread['green_time'] = strtotime(date('Y-m-d', strtotime('+1 day'))); // 开启明天的绿色通道
|
|
$spread['green_time'] = strtotime(date('Y-m-d', strtotime('+1 day'))); // 开启明天的绿色通道
|
|
$spread->save();
|
|
$spread->save();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- $orderCount = AuctionOrder::where([['uid', '=', $user['uid']], ['status','=', 3]])->count();
|
|
|
|
- if ($orderCount >= 5){
|
|
|
|
|
|
+ $orderCount = AuctionOrder::where([['uid', '=', $user['uid']], ['status', '=', 3]])->count();
|
|
|
|
+ if ($orderCount >= 5) {
|
|
$user['is_new'] = 0;
|
|
$user['is_new'] = 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -235,28 +236,28 @@ class AuctionOrder extends BaseModel
|
|
}
|
|
}
|
|
$product = $productModel->where('id', $data['product_id'])->find();
|
|
$product = $productModel->where('id', $data['product_id'])->find();
|
|
$auction = $auctionModel->where('id', $product['auction_id'])->find();
|
|
$auction = $auctionModel->where('id', $product['auction_id'])->find();
|
|
- $time = strtotime(date('Y-m-d' ,strtotime($data['create_time']))); // 订单当天时间段
|
|
|
|
- $totime = strtotime(date('Y-m-d' ,strtotime($data['create_time']))) + 86400; // 订单凌晨时间段
|
|
|
|
- $booking = $bookingModel->where('auction_id', $auction['id'])->where('uid', $user['uid'])->whereBetweenTime('create_time', $time, $totime)->find();
|
|
|
|
- if ($booking['status'] > 0){
|
|
|
|
- $booking['status'] = 0;
|
|
|
|
- $booking->save();
|
|
|
|
- $anticipate = $booking['anticipate'] - $booking['deduction'];
|
|
|
|
|
|
+
|
|
|
|
+ $booking = $bookingModel->where('auction_id', $auction['id'])->where('uid', $user['uid'])->where('frequency', $data['frequency'])->find();
|
|
|
|
+ $fz = $frozenModel->where('order_id', $data['order_id'])->where('status', 1)->where('uid', $user['uid'])->find();
|
|
|
|
+ if ($fz){
|
|
|
|
+ $fz['status'] = 0;
|
|
|
|
+ $anticipate = $fz['anticipate'] - $fz['deduction'];
|
|
$user['anticipate'] = $user['anticipate'] + $anticipate;// 退还预约卷
|
|
$user['anticipate'] = $user['anticipate'] + $anticipate;// 退还预约卷
|
|
- $user->save();
|
|
|
|
|
|
|
|
|
|
+ $user->save();
|
|
|
|
+ $fz->save();
|
|
|
|
+ UserBill::income('艺金券退还',$user['uid'], 'anticipate', 'th_anticipate', $anticipate, $user['spread_uid'], $user['anticipate'], '退还订单'.$data['order_id'].'艺金券,扣除' . $fz['deduction']);
|
|
|
|
|
|
- \app\models\user\UserBill::create([
|
|
|
|
- 'uid' => $user['uid'],
|
|
|
|
- 'pm' => 1,
|
|
|
|
- 'title' => '艺金券退还',
|
|
|
|
- 'category' => 'anticipate',
|
|
|
|
- 'type' => 'th_anticipate',
|
|
|
|
- 'mark' => '退还'.$anticipate.'艺金券扣除'.$booking['deduction'],
|
|
|
|
- 'add_time' => time(),
|
|
|
|
- 'number' => $anticipate,
|
|
|
|
- 'balance' => $user['anticipate']
|
|
|
|
- ]);
|
|
|
|
|
|
+ }else{
|
|
|
|
+ if ($booking['status'] > 0) {
|
|
|
|
+ $booking['status'] = 0;
|
|
|
|
+ $anticipate = $booking['anticipate'] - $booking['deduction'];
|
|
|
|
+ $user['anticipate'] = $user['anticipate'] + $anticipate;// 退还预约卷
|
|
|
|
+
|
|
|
|
+ $user->save();
|
|
|
|
+ $booking->save();
|
|
|
|
+ UserBill::income('艺金券退还',$user['uid'], 'anticipate', 'th_anticipate', $anticipate, $user['spread_uid'], $user['anticipate'], '退还预约艺金券扣除' . $booking['deduction']);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -271,43 +272,75 @@ class AuctionOrder extends BaseModel
|
|
{
|
|
{
|
|
$one = (int)SystemConfigService::get('one_time');
|
|
$one = (int)SystemConfigService::get('one_time');
|
|
$tow = (int)SystemConfigService::get('tow_time');
|
|
$tow = (int)SystemConfigService::get('tow_time');
|
|
- $hour = time()-($one*60); // 一小时以前
|
|
|
|
- $time = time()-($tow*60); // 一个半小时
|
|
|
|
|
|
+ $hour = time() - ($one * 60); // 一小时以前
|
|
|
|
+ $time = time() - ($tow * 60); // 一个半小时
|
|
$order = AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->select(); // 查询不在当前一个半小时内的所有订单
|
|
$order = AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->select(); // 查询不在当前一个半小时内的所有订单
|
|
- if ($order){
|
|
|
|
- foreach ($order as $K => $v){
|
|
|
|
|
|
+ if ($order) {
|
|
|
|
+ foreach ($order as $K => $v) {
|
|
$product = AuctionProduct::where('id', $v['product_id'])->find();
|
|
$product = AuctionProduct::where('id', $v['product_id'])->find();
|
|
$auction = Auction::where('id', $product['auction_id'])->find();
|
|
$auction = Auction::where('id', $product['auction_id'])->find();
|
|
$booking = AuctionBooking::where([['uid', '=', $v['uid']], ['status', '=', 1], ['auction_id', '=', $auction['id']], ['frequency', '=', $auction['frequency']]])->find(); // 找到预约订单
|
|
$booking = AuctionBooking::where([['uid', '=', $v['uid']], ['status', '=', 1], ['auction_id', '=', $auction['id']], ['frequency', '=', $auction['frequency']]])->find(); // 找到预约订单
|
|
- if (strtotime($v['create_time']) <= $hour and strtotime($v['create_time']) > $time){
|
|
|
|
- // 订单在一个小时到一个半小时内
|
|
|
|
- if ($booking){
|
|
|
|
- if ($booking['deduction'] == 0){
|
|
|
|
|
|
+ $fz = AuctionFrozen::where('order_id', $v['order_id'])->where('status', 1)->find();
|
|
|
|
+ if ($fz) {
|
|
|
|
+ if (strtotime($v['create_time']) <= $hour and strtotime($v['create_time']) > $time) {
|
|
|
|
+ // 订单在一个小时到一个半小时内
|
|
|
|
+ if ($fz['deduction'] == 0) {
|
|
$user = \app\models\user\User::where('uid', $v['collection_id'])->find();
|
|
$user = \app\models\user\User::where('uid', $v['collection_id'])->find();
|
|
- $user['anticipate'] = $user['anticipate'] + $booking['anticipate']/2; // 卖家增加预约卷
|
|
|
|
- $booking['deduction'] = $booking['anticipate']/2;
|
|
|
|
- UserBill::income('超时增加', $v['collection_id'], 'anticipate', 'ad_anticipate', $booking['anticipate']/2, $v['uid'], $user['anticipate'], '('.$user['nickname'].'-'.$user['uid'].')超时付款');
|
|
|
|
- UserBill::expend('超时扣除', $v['uid'], 'anticipate', 'dec_anticipate', $booking['anticipate']/2, $v['uid'], $booking['anticipate']/2, '超时付款,扣除冻结'.($booking['anticipate']/2).'艺金券');
|
|
|
|
- $booking->save();
|
|
|
|
|
|
+ $user['anticipate'] = $user['anticipate'] + $fz['anticipate'] / 2; // 卖家增加预约卷
|
|
|
|
+ $fz['deduction'] = $fz['anticipate'] / 2;
|
|
|
|
+ UserBill::income('超时增加', $v['collection_id'], 'anticipate', 'ad_anticipate', $fz['anticipate'] / 2, $v['uid'], $user['anticipate'], '(' . $user['nickname'] . '-' . $user['uid'] . ')超时付款,增加艺金券');
|
|
|
|
+ UserBill::expend('超时扣除', $v['uid'], 'anticipate', 'dec_anticipate', $fz['anticipate'] / 2, $v['uid'], $fz['anticipate'] / 2, '超时付款,扣除订单'.$v['order_id'].'冻结'. ($fz['anticipate'] / 2) . '艺金券');
|
|
|
|
+ $fz->save();
|
|
$user->save();
|
|
$user->save();
|
|
}
|
|
}
|
|
- }
|
|
|
|
- }elseif (strtotime($v['create_time']) <= $time){
|
|
|
|
- if ($booking) {
|
|
|
|
|
|
+ } elseif (strtotime($v['create_time']) <= $time) {
|
|
|
|
+
|
|
$user = \app\models\user\User::where('uid', $v['collection_id'])->find(); //卖家
|
|
$user = \app\models\user\User::where('uid', $v['collection_id'])->find(); //卖家
|
|
- $dedu = $booking['anticipate'] - $booking['deduction'];
|
|
|
|
|
|
+ $dedu = $fz['anticipate'] - $fz['deduction'];
|
|
$user['anticipate'] += $dedu; // 卖家增加预约卷
|
|
$user['anticipate'] += $dedu; // 卖家增加预约卷
|
|
- $booking['deduction'] = $booking['anticipate'];
|
|
|
|
|
|
+ $fz['deduction'] = $fz['anticipate'];
|
|
|
|
+ $fz['status'] = 2;
|
|
|
|
|
|
$user->save();
|
|
$user->save();
|
|
- \app\models\user\User::where('uid', $v['uid'])->update(['status' => 0,'freeze_time' => strtotime('+1 day')]); // 冻结用户
|
|
|
|
- UserBill::income('超时增加', $v['collection_id'], 'anticipate', 'ad_anticipate', $dedu, $v['uid'], $user['anticipate'], '('.$user['nickname'].'-'.$user['uid'].')超时付款');
|
|
|
|
- UserBill::expend('超时扣除', $v['uid'], 'anticipate', 'dec_anticipate', $dedu, $v['uid'], 0, '超时付款,扣除冻结'.$dedu.'艺金券');
|
|
|
|
- $booking->save();
|
|
|
|
|
|
+ \app\models\user\User::where('uid', $v['uid'])->update(['status' => 0, 'freeze_time' => strtotime('+1 day')]); // 冻结用户
|
|
|
|
+ UserBill::income('超时增加', $v['collection_id'], 'anticipate', 'ad_anticipate', $dedu, $v['uid'], $user['anticipate'], '(' . $user['nickname'] . '-' . $user['uid'] . ')超时付款,增加艺金券');
|
|
|
|
+ UserBill::expend('超时扣除', $v['uid'], 'anticipate', 'dec_anticipate', $dedu, $v['uid'], 0, '超时付款,扣除订单'.$v['order_id'].'冻结' . $dedu . '艺金券');
|
|
|
|
+ $fz->save();
|
|
|
|
|
|
- AuctionBooking::where('id', $booking['id'])->update(['status' => 2]); // 修改预约订单状态 为扣除
|
|
|
|
AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->update(['status' => 0]); // 修改为已过期订单
|
|
AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->update(['status' => 0]); // 修改为已过期订单
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ if (strtotime($v['create_time']) <= $hour and strtotime($v['create_time']) > $time) {
|
|
|
|
+ // 订单在一个小时到一个半小时内
|
|
|
|
+ if ($booking) {
|
|
|
|
+ if ($booking['deduction'] == 0) {
|
|
|
|
+ $user = \app\models\user\User::where('uid', $v['collection_id'])->find();
|
|
|
|
+ $user['anticipate'] = $user['anticipate'] + $booking['anticipate'] / 2; // 卖家增加预约卷
|
|
|
|
+ $booking['deduction'] = $booking['anticipate'] / 2;
|
|
|
|
+ UserBill::income('超时增加', $v['collection_id'], 'anticipate', 'ad_anticipate', $booking['anticipate'] / 2, $v['uid'], $user['anticipate'], '(' . $user['nickname'] . '-' . $user['uid'] . ')超时付款,增加艺金券');
|
|
|
|
+ UserBill::expend('超时扣除', $v['uid'], 'anticipate', 'dec_anticipate', $booking['anticipate'] / 2, $v['uid'], $booking['anticipate'] / 2, '超时付款,扣除预约冻结' . ($booking['anticipate'] / 2) . '艺金券');
|
|
|
|
+ $booking->save();
|
|
|
|
+ $user->save();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } elseif (strtotime($v['create_time']) <= $time) {
|
|
|
|
+ if ($booking) {
|
|
|
|
+ $user = \app\models\user\User::where('uid', $v['collection_id'])->find(); //卖家
|
|
|
|
+ $dedu = $booking['anticipate'] - $booking['deduction'];
|
|
|
|
+ $user['anticipate'] += $dedu; // 卖家增加预约卷
|
|
|
|
+ $booking['deduction'] = $booking['anticipate'];
|
|
|
|
+ $booking['status'] = 2;
|
|
|
|
+
|
|
|
|
+ $user->save();
|
|
|
|
+ \app\models\user\User::where('uid', $v['uid'])->update(['status' => 0, 'freeze_time' => strtotime('+1 day')]); // 冻结用户
|
|
|
|
+ UserBill::income('超时增加', $v['collection_id'], 'anticipate', 'ad_anticipate', $dedu, $v['uid'], $user['anticipate'], '(' . $user['nickname'] . '-' . $user['uid'] . ')超时付款,增加艺金券');
|
|
|
|
+ UserBill::expend('超时扣除', $v['uid'], 'anticipate', 'dec_anticipate', $dedu, $v['uid'], 0, '超时付款,扣除预约冻结' . $dedu . '艺金券');
|
|
|
|
+ $booking->save();
|
|
|
|
+
|
|
|
|
+ AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->update(['status' => 0]); // 修改为已过期订单
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -324,15 +357,15 @@ class AuctionOrder extends BaseModel
|
|
public static function th()
|
|
public static function th()
|
|
{
|
|
{
|
|
$auction = Auction::where('rend_time', '<', date('H:i:s', time()))->select();
|
|
$auction = Auction::where('rend_time', '<', date('H:i:s', time()))->select();
|
|
- if ($auction){
|
|
|
|
- foreach ($auction as $k => $v){
|
|
|
|
|
|
+ if ($auction) {
|
|
|
|
+ foreach ($auction as $k => $v) {
|
|
|
|
|
|
- $booking = AuctionBooking::where([['auction_id', '=', $v['id']], ['status','=' , 1]])->select();
|
|
|
|
- if ($booking){
|
|
|
|
- foreach ($booking as $key => $value){
|
|
|
|
|
|
+ $booking = AuctionBooking::where([['auction_id', '=', $v['id']], ['status', '=', 1]])->select();
|
|
|
|
+ if ($booking) {
|
|
|
|
+ foreach ($booking as $key => $value) {
|
|
$product = AuctionProduct::where('auction_id', $value['auction_id'])->column('id');
|
|
$product = AuctionProduct::where('auction_id', $value['auction_id'])->column('id');
|
|
$order = AuctionOrder::where([['product_id', 'in', $product], ['frequency', '=', $value['frequency']], ['uid', '=', $value['uid']]])->find();
|
|
$order = AuctionOrder::where([['product_id', 'in', $product], ['frequency', '=', $value['frequency']], ['uid', '=', $value['uid']]])->find();
|
|
- if (!$order){
|
|
|
|
|
|
+ if (!$order) {
|
|
$find = AuctionBooking::find($value['id']);
|
|
$find = AuctionBooking::find($value['id']);
|
|
$find['status'] = 0;
|
|
$find['status'] = 0;
|
|
|
|
|
|
@@ -341,7 +374,7 @@ class AuctionOrder extends BaseModel
|
|
|
|
|
|
$user->save();
|
|
$user->save();
|
|
$find->save();
|
|
$find->save();
|
|
- UserBill::income('退回艺金券',$user['uid'], 'anticipate', 'add_anticipate', $value['anticipate'], 0, $user['anticipate'], '艺金券'.$value['anticipate'].'退回');
|
|
|
|
|
|
+ UserBill::income('退回艺金券', $user['uid'], 'anticipate', 'add_anticipate', $value['anticipate'], 0, $user['anticipate'], '艺金券' . $value['anticipate'] . '退回');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -353,12 +386,11 @@ class AuctionOrder extends BaseModel
|
|
public static function goods()
|
|
public static function goods()
|
|
{
|
|
{
|
|
$order = AuctionOrder::where('status', 2)->select();
|
|
$order = AuctionOrder::where('status', 2)->select();
|
|
- if ($order){
|
|
|
|
- foreach ($order as &$item)
|
|
|
|
- {
|
|
|
|
|
|
+ if ($order) {
|
|
|
|
+ foreach ($order as &$item) {
|
|
$auction = Auction::where('id', $item['auction_id'])->value('goods_time');
|
|
$auction = Auction::where('id', $item['auction_id'])->value('goods_time');
|
|
$time = $item['voucher_time'] + ($auction * 60); // 自动放货时间
|
|
$time = $item['voucher_time'] + ($auction * 60); // 自动放货时间
|
|
- if (time() > $time){
|
|
|
|
|
|
+ if (time() > $time) {
|
|
// 如果当前时间已经过了
|
|
// 如果当前时间已经过了
|
|
$product = AuctionProduct::where('id', $item['product_id'])->find();
|
|
$product = AuctionProduct::where('id', $item['product_id'])->find();
|
|
$product['uid'] = $item['uid'];// 商品拥有人更新
|
|
$product['uid'] = $item['uid'];// 商品拥有人更新
|
|
@@ -366,7 +398,7 @@ class AuctionOrder extends BaseModel
|
|
$product['order'] = $item['order_id'];
|
|
$product['order'] = $item['order_id'];
|
|
|
|
|
|
self::where('id', $item['id'])->update(['status' => 3]);
|
|
self::where('id', $item['id'])->update(['status' => 3]);
|
|
- self::earn($item['uid'],$item['price'], $product);
|
|
|
|
|
|
+ self::earn($item['uid'], $item['price'], $product);
|
|
self::return($item['id']);
|
|
self::return($item['id']);
|
|
$product->save();
|
|
$product->save();
|
|
}
|
|
}
|
|
@@ -377,7 +409,4 @@ class AuctionOrder extends BaseModel
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|