更新创建转售类型

This commit is contained in:
yaooo 2023-08-16 10:30:32 +08:00
parent 83742ce912
commit 08767ec76c
9 changed files with 47 additions and 30 deletions

View File

@ -38,6 +38,9 @@ class CommunityDao extends BaseDao
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use($where) {
$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) {
$query->where('Community.uid',$where['uid']);
})

View File

@ -45,13 +45,14 @@ class CommunityRepository extends BaseRepository
'is_del' => 0,
];
public const COMMUNIT_TYPE_FONT = '1';
public const COMMUNIT_TYPE_FONT = '1';
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 RESALE_TYPE_STORE = 1; //到店核销
public const RESALE_TYPE_DELIVER = 2; //快递配送
public const RESALE_TYPE_STORE = 1; //到店核销
public const RESALE_TYPE_DELIVER = 2; //快递配送
public const RESALE_TYPE_TRANSFER = 1; //调货
public const RESALE_TYPE_DISCOUNT = 2; //打折
/**
* CommunityRepository constructor.
@ -360,7 +361,7 @@ class CommunityRepository extends BaseRepository
$community = $this->dao->create($data);
if ($data['spu_id'])$this->joinProduct($community->community_id,$data['spu_id']);
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'));
return $community->community_id;
@ -391,7 +392,7 @@ class CommunityRepository extends BaseRepository
$community = $this->dao->update($id, $data);
if ($spuId) $this->joinProduct($id, $spuId);
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'));
});
@ -581,7 +582,7 @@ class CommunityRepository extends BaseRepository
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function resale($id, array $data)
public function resale($id, array $data, $resaleType = 0)
{
$insert = [];
@ -612,7 +613,8 @@ class CommunityRepository extends BaseRepository
'product_attr_unique' => $purchaseRecord['unique'],
'mer_id' => $purchaseRecord['mer_id'],
'number' => $value['number'],
'price' => $value['price'],
'price' => $value['price'],
'type' => $resaleType,
'deliver_method' => $value['deliver_method'] ?? '',
'update_time' => date('Y-m-d H:i:s'),
];

View File

@ -579,10 +579,10 @@ class StoreOrderRepository extends BaseRepository
*/
public function userOrderNumber(int $uid, $product_type=0)
{
//activity_type0 采购订单 98 普通订单
//activity_type0普通订单 98 调货订单 99 打折订单
//$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type);
$isUser = 1;
if ($product_type == 98) {
if ($product_type == 98 || $product_type == 99) {
$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();

View File

@ -8,6 +8,7 @@ use app\common\model\user\User;
use app\common\repositories\store\order\StoreGroupOrderRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use JPush\Client;
use think\facade\Log;
class JgPush
{
@ -24,6 +25,7 @@ class JgPush
public function send($type, $data)
{
Log::info("sms ============= sms");
switch ($type) {
case 'ADMIN_PAY_SUCCESS_CODE':
$groupOrder = app()->make(StoreGroupOrderRepository::class)->get($data['id']);
@ -70,6 +72,7 @@ class JgPush
$this->push->send();
break;
case 'ORDER_CREATE':
Log::info("sms ============= ORDER_CREATE");
$order = app()->make(StoreOrderRepository::class)->get($data['id']);
if ($order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
break;
@ -85,6 +88,23 @@ class JgPush
$this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route, 'type' =>'ORDER_CREATE']]);
$this->push->send();
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:
break;
}

View File

@ -59,9 +59,9 @@ class Community extends BaseController
*/
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['order'] = 'start';
$where['order'] = 'start';
$where['is_del'] = 0;
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->getList($where, $page, $limit));

View File

@ -43,6 +43,7 @@ use think\facade\Db;
use think\facade\Log;
use think\facade\Queue;
use crmeb\jobs\SendSmsJob;
use crmeb\jobs\TestJob;
use app\controller\api\Ceshi;
/**
@ -55,21 +56,8 @@ class Auth extends BaseController
{
public function dotest()
{
$postUrl = 'http://logistics.lihaink.cn/api/lstSet';
$curlPost = [
'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);
Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'id' => 101]);
return app('json')->success();
}
public function test()

View File

@ -271,7 +271,7 @@ class Community extends BaseController
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']);
$data['status'] = 0;
$data['is_show'] = 0;

View File

@ -55,7 +55,7 @@ return [
'client_size' => 2048,
],
'redis' => [
],
],
'listen' => [],

View File

@ -28,6 +28,10 @@ class SendSmsJob implements JobInterface
public function fire($job, $data)
{
$status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']);
if (!$status) {
$job->delete();
}
Log::info('app fire数据' . $status);
if ($status['notice_app'] == 1) {
try {
/** @var JgPush $client */