mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-12 03:01:18 +00:00
调整订单生成函数
This commit is contained in:
parent
94aa866810
commit
57a97873b9
@ -46,10 +46,6 @@ class StoreProductController
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws \think\Exception
|
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @throws \think\exception\DbException
|
|
||||||
*/
|
*/
|
||||||
public function code(Request $request, $id)
|
public function code(Request $request, $id)
|
||||||
{
|
{
|
||||||
@ -103,6 +99,17 @@ class StoreProductController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品详情
|
||||||
|
* @param Request $request
|
||||||
|
* @param $id
|
||||||
|
* @param int $type
|
||||||
|
* @return mixed
|
||||||
|
* @throws \think\Exception
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @throws \think\exception\DbException
|
||||||
|
*/
|
||||||
public function detail(Request $request, $id,$type = 0)
|
public function detail(Request $request, $id,$type = 0)
|
||||||
{
|
{
|
||||||
if (!$id || !($storeInfo = StoreProduct::getValidProduct($id))) return app('json')->fail('商品不存在或已下架');
|
if (!$id || !($storeInfo = StoreProduct::getValidProduct($id))) return app('json')->fail('商品不存在或已下架');
|
||||||
|
|||||||
@ -335,7 +335,7 @@ class StoreOrder extends BaseModel
|
|||||||
}
|
}
|
||||||
$orderInfo = [
|
$orderInfo = [
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
'order_id' => $test ? 0 : self::getNewOrderId($uid),
|
'order_id' => $test ? 0 : self::getNewOrderId(),
|
||||||
'real_name' => $addressInfo['real_name'],
|
'real_name' => $addressInfo['real_name'],
|
||||||
'user_phone' => $addressInfo['phone'],
|
'user_phone' => $addressInfo['phone'],
|
||||||
'user_address' => $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['detail'],
|
'user_address' => $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['detail'],
|
||||||
@ -490,10 +490,10 @@ class StoreOrder extends BaseModel
|
|||||||
* @param $uid 用户uid
|
* @param $uid 用户uid
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getNewOrderId($uid)
|
public static function getNewOrderId()
|
||||||
{
|
{
|
||||||
list($msec, $sec) = explode(' ', microtime());
|
list($msec, $sec) = explode(' ', microtime());
|
||||||
$msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000,0,'','');
|
||||||
$orderId = 'wx' . $msectime . mt_rand(10000,99999);
|
$orderId = 'wx' . $msectime . mt_rand(10000,99999);
|
||||||
if(self::be(['order_id'=>$orderId])) $orderId = 'wx' . $msectime . mt_rand(10000,99999);
|
if(self::be(['order_id'=>$orderId])) $orderId = 'wx' . $msectime . mt_rand(10000,99999);
|
||||||
return $orderId;
|
return $orderId;
|
||||||
|
|||||||
@ -133,8 +133,9 @@ class OrderSubscribe
|
|||||||
//检测会员等级
|
//检测会员等级
|
||||||
event('UserLevelAfter', [$order['uid']]);
|
event('UserLevelAfter', [$order['uid']]);
|
||||||
|
|
||||||
|
try{
|
||||||
//向后台发送新订单消息
|
//向后台发送新订单消息
|
||||||
ChannelService::instance()->send('NEW_ORDER', ['order_id'=>$order['order_id']]);
|
ChannelService::instance()->send('NEW_ORDER', ['order_id'=>$order['order_id']]);
|
||||||
|
}catch (\Throwable $e){}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user