更新创建转售类型
This commit is contained in:
parent
83742ce912
commit
08767ec76c
@ -38,6 +38,9 @@ class CommunityDao extends BaseDao
|
|||||||
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use($where) {
|
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use($where) {
|
||||||
$query->whereLike('Community.title',"%{$where['keyword']}%");
|
$query->whereLike('Community.title',"%{$where['keyword']}%");
|
||||||
})
|
})
|
||||||
|
->when(isset($where['resale_type']) && $where['resale_type'] !== '', function ($query) use($where) {
|
||||||
|
$query->where('Community.resale_type', $where['resale_type']);
|
||||||
|
})
|
||||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use($where) {
|
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use($where) {
|
||||||
$query->where('Community.uid',$where['uid']);
|
$query->where('Community.uid',$where['uid']);
|
||||||
})
|
})
|
||||||
|
@ -49,9 +49,10 @@ class CommunityRepository extends BaseRepository
|
|||||||
public const COMMUNIT_TYPE_VIDEO = '2';
|
public const COMMUNIT_TYPE_VIDEO = '2';
|
||||||
public const COMMUNITY_TYPE_RESALE = 3; //转售贴
|
public const COMMUNITY_TYPE_RESALE = 3; //转售贴
|
||||||
public const COMMUNITY_TYPE_ENTRUST = 4; //委托销售贴
|
public const COMMUNITY_TYPE_ENTRUST = 4; //委托销售贴
|
||||||
|
|
||||||
public const RESALE_TYPE_STORE = 1; //到店核销
|
public const RESALE_TYPE_STORE = 1; //到店核销
|
||||||
public const RESALE_TYPE_DELIVER = 2; //快递配送
|
public const RESALE_TYPE_DELIVER = 2; //快递配送
|
||||||
|
public const RESALE_TYPE_TRANSFER = 1; //调货
|
||||||
|
public const RESALE_TYPE_DISCOUNT = 2; //打折
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CommunityRepository constructor.
|
* CommunityRepository constructor.
|
||||||
@ -360,7 +361,7 @@ class CommunityRepository extends BaseRepository
|
|||||||
$community = $this->dao->create($data);
|
$community = $this->dao->create($data);
|
||||||
if ($data['spu_id'])$this->joinProduct($community->community_id,$data['spu_id']);
|
if ($data['spu_id'])$this->joinProduct($community->community_id,$data['spu_id']);
|
||||||
if ($data['product_info'] && $data['is_type'] == self::COMMUNITY_TYPE_RESALE) {
|
if ($data['product_info'] && $data['is_type'] == self::COMMUNITY_TYPE_RESALE) {
|
||||||
$this->resale($community->community_id, $data['product_info']);
|
$this->resale($community->community_id, $data['product_info'], $data['resale_type'] ?? 0);
|
||||||
}
|
}
|
||||||
event('community.create',compact('community'));
|
event('community.create',compact('community'));
|
||||||
return $community->community_id;
|
return $community->community_id;
|
||||||
@ -391,7 +392,7 @@ class CommunityRepository extends BaseRepository
|
|||||||
$community = $this->dao->update($id, $data);
|
$community = $this->dao->update($id, $data);
|
||||||
if ($spuId) $this->joinProduct($id, $spuId);
|
if ($spuId) $this->joinProduct($id, $spuId);
|
||||||
if ($productInfo && $data['is_type'] == self::COMMUNITY_TYPE_RESALE) {
|
if ($productInfo && $data['is_type'] == self::COMMUNITY_TYPE_RESALE) {
|
||||||
$this->resale($id, $productInfo);
|
$this->resale($id, $productInfo, $data['resale_type'] ?? 0);
|
||||||
}
|
}
|
||||||
event('community.update.before',compact('id','community'));
|
event('community.update.before',compact('id','community'));
|
||||||
});
|
});
|
||||||
@ -581,7 +582,7 @@ class CommunityRepository extends BaseRepository
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function resale($id, array $data)
|
public function resale($id, array $data, $resaleType = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$insert = [];
|
$insert = [];
|
||||||
@ -613,6 +614,7 @@ class CommunityRepository extends BaseRepository
|
|||||||
'mer_id' => $purchaseRecord['mer_id'],
|
'mer_id' => $purchaseRecord['mer_id'],
|
||||||
'number' => $value['number'],
|
'number' => $value['number'],
|
||||||
'price' => $value['price'],
|
'price' => $value['price'],
|
||||||
|
'type' => $resaleType,
|
||||||
'deliver_method' => $value['deliver_method'] ?? '',
|
'deliver_method' => $value['deliver_method'] ?? '',
|
||||||
'update_time' => date('Y-m-d H:i:s'),
|
'update_time' => date('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
|
@ -579,10 +579,10 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function userOrderNumber(int $uid, $product_type=0)
|
public function userOrderNumber(int $uid, $product_type=0)
|
||||||
{
|
{
|
||||||
//activity_type:0 采购订单 98 普通订单
|
//activity_type:0普通订单 98 调货订单 99 打折订单
|
||||||
//$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type);
|
//$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type);
|
||||||
$isUser = 1;
|
$isUser = 1;
|
||||||
if ($product_type == 98) {
|
if ($product_type == 98 || $product_type == 99) {
|
||||||
$isUser = 0;
|
$isUser = 0;
|
||||||
}
|
}
|
||||||
$noPay = $this->dao->search(['uid' => $uid, 'status' => 0, 'paid' => 0, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
$noPay = $this->dao->search(['uid' => $uid, 'status' => 0, 'paid' => 0, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
||||||
|
@ -8,6 +8,7 @@ use app\common\model\user\User;
|
|||||||
use app\common\repositories\store\order\StoreGroupOrderRepository;
|
use app\common\repositories\store\order\StoreGroupOrderRepository;
|
||||||
use app\common\repositories\store\order\StoreOrderRepository;
|
use app\common\repositories\store\order\StoreOrderRepository;
|
||||||
use JPush\Client;
|
use JPush\Client;
|
||||||
|
use think\facade\Log;
|
||||||
|
|
||||||
class JgPush
|
class JgPush
|
||||||
{
|
{
|
||||||
@ -24,6 +25,7 @@ class JgPush
|
|||||||
|
|
||||||
public function send($type, $data)
|
public function send($type, $data)
|
||||||
{
|
{
|
||||||
|
Log::info("sms ============= sms");
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'ADMIN_PAY_SUCCESS_CODE':
|
case 'ADMIN_PAY_SUCCESS_CODE':
|
||||||
$groupOrder = app()->make(StoreGroupOrderRepository::class)->get($data['id']);
|
$groupOrder = app()->make(StoreGroupOrderRepository::class)->get($data['id']);
|
||||||
@ -70,6 +72,7 @@ class JgPush
|
|||||||
$this->push->send();
|
$this->push->send();
|
||||||
break;
|
break;
|
||||||
case 'ORDER_CREATE':
|
case 'ORDER_CREATE':
|
||||||
|
Log::info("sms ============= ORDER_CREATE");
|
||||||
$order = app()->make(StoreOrderRepository::class)->get($data['id']);
|
$order = app()->make(StoreOrderRepository::class)->get($data['id']);
|
||||||
if ($order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
if ($order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
break;
|
break;
|
||||||
@ -85,6 +88,23 @@ class JgPush
|
|||||||
$this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route, 'type' =>'ORDER_CREATE']]);
|
$this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route, 'type' =>'ORDER_CREATE']]);
|
||||||
$this->push->send();
|
$this->push->send();
|
||||||
break;
|
break;
|
||||||
|
case 'ORDER_PAY_SUCCESS':
|
||||||
|
$order = app()->make(StoreOrderRepository::class)->get($data['id']);
|
||||||
|
if ($order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$route = "/pages/admin/orderDetail/index?id={$order['order_id']}&mer_id={$order['mer_id']}";
|
||||||
|
$merUserId = Merchant::where('mer_id', $order['mer_id'])->value('uid');
|
||||||
|
$jgRegisterId = User::where('uid', $merUserId)->value('jg_register_id');
|
||||||
|
if (empty($jgRegisterId)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$this->addRegistrationId($jgRegisterId);
|
||||||
|
$this->androidNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route, 'type' =>'ORDER_PAY_SUCCESS']]);
|
||||||
|
$this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route, 'type' =>'ORDER_PAY_SUCCESS']]);
|
||||||
|
$this->push->send();
|
||||||
|
Log::info("ORDER_CREATE ============= 您有新的订单,请注意查看。");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class Community extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function resale()
|
public function resale()
|
||||||
{
|
{
|
||||||
$where = $this->request->params(['keyword','status','username','category_id','topic_id','is_show','is_type']);
|
$where = $this->request->params(['keyword','status','username','category_id','topic_id','is_show','is_type','resale_type']);
|
||||||
$where['is_type'] = '3';
|
$where['is_type'] = '3';
|
||||||
$where['order'] = 'start';
|
$where['order'] = 'start';
|
||||||
$where['is_del'] = 0;
|
$where['is_del'] = 0;
|
||||||
|
@ -43,6 +43,7 @@ use think\facade\Db;
|
|||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
use think\facade\Queue;
|
use think\facade\Queue;
|
||||||
use crmeb\jobs\SendSmsJob;
|
use crmeb\jobs\SendSmsJob;
|
||||||
|
use crmeb\jobs\TestJob;
|
||||||
use app\controller\api\Ceshi;
|
use app\controller\api\Ceshi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,21 +56,8 @@ class Auth extends BaseController
|
|||||||
{
|
{
|
||||||
public function dotest()
|
public function dotest()
|
||||||
{
|
{
|
||||||
$postUrl = 'http://logistics.lihaink.cn/api/lstSet';
|
Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'id' => 101]);
|
||||||
$curlPost = [
|
return app('json')->success();
|
||||||
'order_id' => '297',
|
|
||||||
'order_sn' => 'wxo1691646210943621611',
|
|
||||||
];
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $postUrl);
|
|
||||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
|
|
||||||
$data = curl_exec($ch);
|
|
||||||
$logisticsInfo = json_decode($data, true);
|
|
||||||
curl_close($ch);
|
|
||||||
return app('json')->success($logisticsInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test()
|
public function test()
|
||||||
|
@ -271,7 +271,7 @@ class Community extends BaseController
|
|||||||
|
|
||||||
public function checkParams()
|
public function checkParams()
|
||||||
{
|
{
|
||||||
$data = $this->request->params(['image','topic_id','content','spu_id','order_id',['is_type',1],'video_link', 'product_info']);
|
$data = $this->request->params(['image','topic_id','content','spu_id','order_id',['is_type',1],'video_link', 'resale_type', 'product_info']);
|
||||||
$config = systemConfig(["community_app_switch",'community_audit','community_video_audit']);
|
$config = systemConfig(["community_app_switch",'community_audit','community_video_audit']);
|
||||||
$data['status'] = 0;
|
$data['status'] = 0;
|
||||||
$data['is_show'] = 0;
|
$data['is_show'] = 0;
|
||||||
|
@ -28,6 +28,10 @@ class SendSmsJob implements JobInterface
|
|||||||
public function fire($job, $data)
|
public function fire($job, $data)
|
||||||
{
|
{
|
||||||
$status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']);
|
$status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']);
|
||||||
|
if (!$status) {
|
||||||
|
$job->delete();
|
||||||
|
}
|
||||||
|
Log::info('app fire数据:' . $status);
|
||||||
if ($status['notice_app'] == 1) {
|
if ($status['notice_app'] == 1) {
|
||||||
try {
|
try {
|
||||||
/** @var JgPush $client */
|
/** @var JgPush $client */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user