|
|
@ -11,6 +11,7 @@ use cores\exception\BaseException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
|
|
|
use think\Model; |
|
|
|
use think\Paginator; |
|
|
|
use think\Paginator; |
|
|
|
|
|
|
|
|
|
|
|
class ServerOrder extends Order |
|
|
|
class ServerOrder extends Order |
|
|
@ -68,6 +69,72 @@ class ServerOrder extends Order |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @notes: |
|
|
|
|
|
|
|
* @param $where |
|
|
|
|
|
|
|
* @return bool |
|
|
|
|
|
|
|
* @throws BaseException |
|
|
|
|
|
|
|
* @author: wanghousheng |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function confirmSuccess($where): bool |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 当前用户ID |
|
|
|
|
|
|
|
$userId = UserService::getCurrentLoginUserId(); |
|
|
|
|
|
|
|
if (!UserService::isDealerEngineer() || !UserService::isStore()) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (UserService::isDealerEngineer()) { |
|
|
|
|
|
|
|
$where = array_merge($where, ['dealer_id' => $userId]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//分销商工程师 |
|
|
|
|
|
|
|
$order_id = $this->where($where) |
|
|
|
|
|
|
|
->where(['order_status' => ServerEnum::APPLYSERVER]) |
|
|
|
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
|
|
|
->value('order_id'); |
|
|
|
|
|
|
|
if (!empty($order_id)) { |
|
|
|
|
|
|
|
$this->where(['id' => $order_id])->save(['order_status' => ServerEnum::COMPLETED]); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @notes:订单详情 |
|
|
|
|
|
|
|
* @param $where |
|
|
|
|
|
|
|
* @return ServerOrder|array|mixed|Model|null |
|
|
|
|
|
|
|
* @throws BaseException |
|
|
|
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
|
|
|
* @throws DbException |
|
|
|
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
|
|
|
* @author: wanghousheng |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function info($where) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 当前用户ID |
|
|
|
|
|
|
|
$userId = UserService::getCurrentLoginUserId(); |
|
|
|
|
|
|
|
//判断当前用户身份 |
|
|
|
|
|
|
|
if (UserService::isDealerEngineer()) { |
|
|
|
|
|
|
|
//分销商工程师 |
|
|
|
|
|
|
|
return $this->with(['image', 'user']) |
|
|
|
|
|
|
|
->where($where) |
|
|
|
|
|
|
|
->where('dealer_id', '=', $userId) |
|
|
|
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
|
|
|
->find(); |
|
|
|
|
|
|
|
} elseif (UserService::isStore()) { |
|
|
|
|
|
|
|
// 店主 |
|
|
|
|
|
|
|
return $this->with(['image', 'user', 'dealer']) |
|
|
|
|
|
|
|
->where($where) |
|
|
|
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
|
|
|
->find(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return $this->with(['image', 'dealer']) |
|
|
|
|
|
|
|
->where($where) |
|
|
|
|
|
|
|
->where('user_id', '=', $userId) |
|
|
|
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
|
|
|
->find(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取用户订单详情(仅订单记录) |
|
|
|
* 获取用户订单详情(仅订单记录) |
|
|
|
* @param int $orderId |
|
|
|
* @param int $orderId |
|
|
|