2.11版本更新
This commit is contained in:
parent
d0ee2cd178
commit
fd62937b7f
@ -593,6 +593,7 @@ if (!function_exists('image_to_base64')) {
|
||||
*/
|
||||
function image_to_base64($avatar = '', $timeout = 9)
|
||||
{
|
||||
checkSuffix($avatar);
|
||||
try {
|
||||
$url = parse_url($avatar);
|
||||
$url = $url['host'];
|
||||
@ -1024,14 +1025,15 @@ if (!function_exists('filter_emoji')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高德经纬度改百度经纬度
|
||||
* @param $lng 经度
|
||||
* @param $lat 纬度
|
||||
* @return mixed
|
||||
/*
|
||||
* TODO 腾讯地图转换百度地图 GCJ02 转 BD09
|
||||
* 中国正常GCJ02坐标---->百度地图BD09坐标
|
||||
* 腾讯地图/高德地图用的也是GCJ02坐标
|
||||
* @param double $lat 纬度
|
||||
* @param double $lng 经度
|
||||
*/
|
||||
if (!function_exists('bd_encrypt')) {
|
||||
function bd_encrypt($lng, $lat)
|
||||
if (!function_exists('gcj02ToBd09')) {
|
||||
function gcj02ToBd09($lng, $lat)
|
||||
{
|
||||
$x_pi = 3.14159265358979324 * 3000.0 / 180.0;
|
||||
$x = $lng;
|
||||
@ -1039,9 +1041,9 @@ if (!function_exists('bd_encrypt')) {
|
||||
$z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * $x_pi);
|
||||
$theta = atan2($y, $x) - 0.000003 * cos($x * $x_pi);
|
||||
|
||||
$data['lng'] = $z * cos($theta) + 0.0065;
|
||||
$data['lat'] = $z * sin($theta) + 0.006;
|
||||
return $data;
|
||||
$lng = $z * cos($theta) + 0.0065;
|
||||
$lat = $z * sin($theta) + 0.006;
|
||||
return [$lng,$lat];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1126,6 +1128,32 @@ if (!function_exists('aj_get_serevice')) {
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('checkSuffix')) {
|
||||
function checkSuffix($data)
|
||||
{
|
||||
$suffix = \think\facade\Config::get('upload.fileExt');
|
||||
if (is_array($data)){
|
||||
foreach ($data as $datum) {
|
||||
if (strpos($datum,'phar://') !== false)
|
||||
throw new \think\exception\ValidateException('操作失败');
|
||||
$result = pathinfo($datum);
|
||||
if (isset($result['extension']) && !in_array($result['extension'],$suffix)) {
|
||||
throw new \think\exception\ValidateException('文件后缀不允许');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strpos($data,'phar://') !== false )
|
||||
throw new \think\exception\ValidateException('操作失败');
|
||||
$result = pathinfo($data);
|
||||
if (isset($result['extension']) && !in_array($result['extension'],$suffix)) {
|
||||
throw new \think\exception\ValidateException('文件后缀不允许');
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('validateIDCard')) {
|
||||
|
||||
function validateIDCard(string $idcard)
|
||||
|
@ -15,6 +15,7 @@ namespace app\common\dao\community;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\community\Community;
|
||||
use app\common\model\system\Relevance;
|
||||
use app\common\repositories\system\RelevanceRepository;
|
||||
|
||||
class CommunityDao extends BaseDao
|
||||
@ -33,7 +34,6 @@ class CommunityDao extends BaseDao
|
||||
});
|
||||
$query->where(true);
|
||||
});
|
||||
|
||||
$query
|
||||
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use($where) {
|
||||
$query->whereLike('Community.title',"%{$where['keyword']}%");
|
||||
@ -73,8 +73,12 @@ class CommunityDao extends BaseDao
|
||||
})
|
||||
->when(isset($where['category_id']) && $where['category_id'] !== '', function ($query) use($where) {
|
||||
$query->where('Community.category_id',$where['category_id']);
|
||||
})->when(isset($where['no_category_id']) && $where['no_category_id'] ==69, function ($query) use($where) {
|
||||
$query->where('Community.category_id','<>',69);
|
||||
})
|
||||
->when(isset($where['spu_id']) && $where['spu_id'] !== '', function ($query) use($where) {
|
||||
$id = Relevance::where('right_id', $where['spu_id'])
|
||||
->where('type',RelevanceRepository::TYPE_COMMUNITY_PRODUCT)
|
||||
->column('left_id');
|
||||
$query->where('community_id','in', $id);
|
||||
});
|
||||
|
||||
$order = 'Community.create_time DESC';
|
||||
|
@ -128,17 +128,17 @@ class StoreCouponDao extends BaseDao
|
||||
$query->where('C.type', $where['type']);
|
||||
}
|
||||
})
|
||||
->when(isset($where['send_type']) && $where['send_type'] != '', function($query) use($where){
|
||||
->when(isset($where['send_type']) && $where['send_type'] !== '', function($query) use($where){
|
||||
$query->where('C.send_type', $where['send_type']);
|
||||
})
|
||||
->when(isset($where['not_svip']) && $where['not_svip'] != '', function($query) use($where){
|
||||
->when(isset($where['not_svip']) && $where['not_svip'] !== '', function($query) use($where){
|
||||
$query->where('C.send_type', '<>',StoreCouponRepository::GET_COUPON_TYPE_SVIP);
|
||||
})
|
||||
->when($uid, function($query) use($uid){
|
||||
$couponId = StoreCouponUser::where('uid',$uid)->whereIn('status',[1,2])->column('coupon_id');
|
||||
$query->whereNotIn('C.coupon_id', $couponId);
|
||||
})
|
||||
->when(isset($where['mer_id']) && $where['mer_id'] != '', function($query) use($where){
|
||||
->when(isset($where['mer_id']) && $where['mer_id'] !== '', function($query) use($where){
|
||||
$query->where('C.mer_id', $where['mer_id']);
|
||||
})
|
||||
->where(function (BaseQuery $query) {
|
||||
|
@ -200,15 +200,6 @@ class StoreOrderDao extends BaseDao
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function groupBuyingStatus(array $orderIds, $status)
|
||||
{
|
||||
if (!count($orderIds)) return 0;
|
||||
$make = app()->make(StoreOrderStatusRepository::class);
|
||||
foreach ($orderIds as $id){
|
||||
$make->status($id,$make::ORDER_STATUS_GROUP_SUCCESS,'拼团成功');
|
||||
}
|
||||
return StoreOrder::getDB()->whereIn('order_id', $orderIds)->update(compact('status'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
|
@ -53,7 +53,7 @@ class StoreOrderProductDao extends BaseDao
|
||||
public function userOrderProduct($id, $uid)
|
||||
{
|
||||
return StoreOrderProduct::getDB()->where('uid', $uid)->where('order_product_id', $id)->with(['orderInfo' => function (Relation $query) {
|
||||
$query->field('order_id,mer_id')->where('status', 2);
|
||||
$query->field('order_id,order_sn,mer_id')->where('status', 2);
|
||||
}])->find();
|
||||
}
|
||||
|
||||
@ -133,14 +133,11 @@ class StoreOrderProductDao extends BaseDao
|
||||
public function getUserPayProduct(?string $keyword, int $uid)
|
||||
{
|
||||
$query = StoreOrderProduct::hasWhere('spu',function($query) use($keyword){
|
||||
|
||||
$query->when($keyword, function ($query) use($keyword) {
|
||||
$query->whereLike('store_name',"%{$keyword}%");
|
||||
});
|
||||
|
||||
$query->where('product_type',0);
|
||||
});
|
||||
|
||||
$query->where('uid', $uid)->where('StoreOrderProduct.product_type',0);
|
||||
return $query;
|
||||
}
|
||||
|
@ -43,9 +43,22 @@ class StoreOrderStatusDao extends BaseDao
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
public function search($id)
|
||||
public function search($where)
|
||||
{
|
||||
return $query = ($this->getModel()::getDB())->where('order_id', $id);
|
||||
$query = ($this->getModel()::getDB())
|
||||
->when(isset($where['id']) && $where['id'] !== '', function($query) use($where){
|
||||
$query->where('order_id', $where['id']);
|
||||
})
|
||||
->when(isset($where['type']) && $where['type'] !== '', function($query) use($where){
|
||||
$query->where('type', $where['type']);
|
||||
})
|
||||
->when(isset($where['user_type']) && $where['user_type'] !== '', function($query) use($where){
|
||||
$query->where('user_type', $where['user_type']);
|
||||
})
|
||||
->when(isset($where['date']) && $where['date'] !== '', function($query) use($where){
|
||||
getModelTime($query, $where['date'],'change_time');
|
||||
});
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getTimeoutDeliveryOrder($end)
|
||||
|
@ -138,11 +138,6 @@ class ProductDao extends BaseDao
|
||||
else if ($where['hot_type'] == 'good')
|
||||
$query->where('is_benefit', 1);
|
||||
})
|
||||
->when(isset($where['pid']) && $where['pid'] !== '', function ($query) use ($where) {
|
||||
$storeCategoryRepository = app()->make(StoreCategoryRepository::class);
|
||||
$ids = array_merge($storeCategoryRepository->findChildrenId((int)$where['pid']), [(int)$where['pid']]);
|
||||
if (count($ids)) $query->whereIn('cate_id', $ids);
|
||||
})
|
||||
->when(isset($where['us_status']) && $where['us_status'] !== '', function ($query) use ($where) {
|
||||
if ($where['us_status'] == 0) {
|
||||
$query->where('Product.is_show', 0)->where('Product.is_used', 1)->where('Product.status',1);
|
||||
@ -162,6 +157,9 @@ class ProductDao extends BaseDao
|
||||
->when(isset($where['sys_labels']) && $where['sys_labels'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('U.sys_labels', "%,{$where['sys_labels']},%");
|
||||
})
|
||||
->when(isset($where['svip_price_type']) && $where['svip_price_type'] !== '', function ($query) use ($where) {
|
||||
$query->where('Product.svip_price_type',$where['svip_price_type']);
|
||||
})
|
||||
->when(isset($where['order']), function ($query) use ($where, $merId) {
|
||||
if(in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales']) ){
|
||||
if ($where['order'] == 'price_asc') {
|
||||
@ -391,11 +389,12 @@ class ProductDao extends BaseDao
|
||||
* @author Qinii
|
||||
* @day 2020-07-09
|
||||
*/
|
||||
public function decCareCount(int $productId)
|
||||
public function decCareCount(array $productId)
|
||||
{
|
||||
($this->getModel()::getDB())->where($this->getPk(), $productId)->where('care_count', '>', 0)->dec('care_count', 1)->update();
|
||||
($this->getModel()::getDB())->whereIn($this->getPk(), $productId)->where('care_count', '>', 0)->dec('care_count', 1)->update();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO api展示的商品条件
|
||||
* @return array
|
||||
|
@ -36,6 +36,6 @@ class ProductGroupUserDao extends BaseDao
|
||||
|
||||
public function groupOrderIds($productGroupId)
|
||||
{
|
||||
return ProductGroupUser::getDB()->where('group_buying_id', $productGroupId)->where('order_id', '>', 0)->column('order_id');
|
||||
return ProductGroupUser::getDB()->where('group_buying_id', $productGroupId)->where('order_id', '>', 0)->select();
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ class ProductSkuDao extends BaseDao
|
||||
return ProductSku::class;
|
||||
}
|
||||
|
||||
public function clear(array $id, int $type)
|
||||
public function clear(int $id, int $type)
|
||||
{
|
||||
$this->getModel()::getDB()->whereIn('active_id', $id)->where('active_type', $type)->delete();
|
||||
$this->getModel()::getDB()->where('active_id', $id)->where('active_type', $type)->delete();
|
||||
}
|
||||
|
||||
public function descStock(int $active_id, string $unique, int $desc)
|
||||
|
@ -29,7 +29,7 @@ class SpuDao extends BaseDao
|
||||
{
|
||||
$order = 'P.sort DESC';
|
||||
if(isset($where['order'])){
|
||||
if(in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales','is_benefit'])){
|
||||
if(in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales'])){
|
||||
if ($where['order'] == 'price_asc') {
|
||||
$order = 'S.price ASC';
|
||||
} else if ($where['order'] == 'price_desc') {
|
||||
@ -80,18 +80,6 @@ class SpuDao extends BaseDao
|
||||
|
||||
$query->whereIn('P.mer_id',$merId);
|
||||
})
|
||||
->when(isset($where['merchant_category_id']) && $where['merchant_category_id'] !== '',function($query)use($where){
|
||||
$merId = app()->make(MerchantRepository::class)->search([
|
||||
'merchant_category_id' => $where['merchant_category_id'],
|
||||
'status' => 1,
|
||||
'mer_state' => 1,
|
||||
'is_del' => 1,
|
||||
])->column('mer_id');
|
||||
$query->whereIn('P.mer_id',$merId);
|
||||
})
|
||||
->when(isset($where['is_good']) && $where['is_good'] !== '',function($query)use($where){
|
||||
$query->where('P.is_good',$where['is_good']);
|
||||
})
|
||||
->when(isset($where['cate_pid']) && $where['cate_pid'], function ($query) use ($where) {
|
||||
$storeCategoryRepository = app()->make(StoreCategoryRepository::class);
|
||||
if (is_array($where['cate_pid'])) {
|
||||
|
@ -27,11 +27,7 @@ class StoreDiscountProductDao extends BaseDao
|
||||
|
||||
public function clear($id)
|
||||
{
|
||||
return Db::transaction(function () use($id){
|
||||
$discount_product_id = $this->getModel()::getDb()->where('discount_id',$id)->column('discount_product_id');
|
||||
$this->getModel()::getDb()->where('discount_id',$id)->delete();
|
||||
app()->make(ProductSkuRepository::class)->clear($discount_product_id, 10);
|
||||
});
|
||||
$this->getModel()::getDb()->where('discount_id',$id)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ class StoreServiceDao extends BaseDao
|
||||
|
||||
public function getRandService($merId)
|
||||
{
|
||||
$services = StoreService::getDB()->where('mer_id', $merId)->where('is_del', 0)->where('status', 1)->order('status DESC, sort DESC, create_time ASC')
|
||||
$services = StoreService::getDB()->where('mer_id', $merId)->where('is_open',1)->where('is_del', 0)->where('status', 1)->order('status DESC, sort DESC, create_time ASC')
|
||||
->hidden(['is_del'])->select();
|
||||
if (!$services || !count($services)) return null;
|
||||
if (count($services) === 1) $services[0];
|
||||
@ -181,7 +181,7 @@ class StoreServiceDao extends BaseDao
|
||||
*/
|
||||
public function getValidServiceInfo($id)
|
||||
{
|
||||
return StoreService::getDB()->where('service_id', $id)->where('status', 1)->where('is_del', 0)->hidden(['is_del'])->find();
|
||||
return StoreService::getDB()->where('service_id', $id)->where('is_open',1)->where('status', 1)->where('is_del', 0)->hidden(['is_del'])->find();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,9 +100,7 @@ class MerchantDao extends BaseDao
|
||||
$query->when($order, function ($query) use ($where, $order) {
|
||||
if ($order == 'rate') {
|
||||
$query->order('is_best DESC, product_score DESC,service_score DESC,postage_score DESC');
|
||||
} else if ($order == 'sales'){
|
||||
$query->order('sales DESC,is_best DESC,sort DESC');
|
||||
}else if ($order == 'location' && isset($where['location']['long'], $where['location']['lat'])) {
|
||||
} else if ($order == 'location' && isset($where['location']['long'], $where['location']['lat'])) {
|
||||
$lng = (float)$where['location']['long'];
|
||||
$lat = (float)$where['location']['lat'];
|
||||
$query->whereNotNull('lat')->whereNotNull('long')
|
||||
@ -168,9 +166,9 @@ class MerchantDao extends BaseDao
|
||||
* @param int $merId
|
||||
* @author Qinii
|
||||
*/
|
||||
public function decCareCount(int $merId)
|
||||
public function decCareCount(array $merId)
|
||||
{
|
||||
($this->getModel()::getDB())->where($this->getPk(), $merId)->where('care_count', '>', 0)->dec('care_count', 1)->update();
|
||||
($this->getModel()::getDB())->whereIn($this->getPk(), $merId)->where('care_count', '>', 0)->dec('care_count', 1)->update();
|
||||
}
|
||||
|
||||
public function dateMerchantNum($date)
|
||||
|
@ -112,11 +112,7 @@ class UserBillDao extends BaseDao
|
||||
public function lockBrokerage($uid)
|
||||
{
|
||||
$lst = UserBill::getDB()->where('category', 'brokerage')
|
||||
->whereIn('type', ['order_one', 'order_two'])
|
||||
->where('uid', $uid)
|
||||
->where('status', 0)
|
||||
->field('link_id,number')
|
||||
->select()->toArray();
|
||||
->whereIn('type', ['order_one', 'order_two'])->where('uid', $uid)->where('status', 0)->field('link_id,number')->select()->toArray();
|
||||
$refundPrice = 0;
|
||||
if (count($lst)) {
|
||||
$refundPrice = -1 * UserBill::getDB()->whereIn('link_id', array_column($lst, 'link_id'))->where('uid', $uid)
|
||||
@ -234,9 +230,6 @@ class UserBillDao extends BaseDao
|
||||
->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) {
|
||||
$query->where('mer_id', $where['mer_id']);
|
||||
})
|
||||
->when(isset($where['source']) && $where['source'] !== '', function ($query) use ($where) {
|
||||
$query->where('source', $where['source']);
|
||||
})
|
||||
->when(isset($where['link_id']) && $where['link_id'] !== '', function ($query) use ($where) {
|
||||
$query->where('link_id', $where['link_id']);
|
||||
});
|
||||
|
@ -350,7 +350,7 @@ class UserDao extends BaseDao
|
||||
|
||||
public function decSpreadCount($uid)
|
||||
{
|
||||
User::getDB()->where('uid', $uid)->update([
|
||||
User::getDB()->where('uid', $uid)->where('spread_count','>',0)->update([
|
||||
'spread_count' => Db::raw('spread_count - 1')
|
||||
]);
|
||||
}
|
||||
|
@ -44,8 +44,6 @@ class UserExtractDao extends BaseDao
|
||||
$query->where('UserExtract.real_name','%'.$where['real_name'].'%');
|
||||
})->when(isset($where['date']) && $where['date'] != '',function($query)use($where){
|
||||
getModelTime($query, $where['date']);
|
||||
})->when(isset($where['source']) && $where['source'] != '',function($query)use($where){
|
||||
$query->where('UserExtract.source',$where['source']);
|
||||
})->order('UserExtract.create_time DESC');
|
||||
|
||||
return $query;
|
||||
|
@ -16,6 +16,7 @@ namespace app\common\dao\user;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\user\UserRecharge;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use think\db\BaseQuery;
|
||||
|
||||
/**
|
||||
@ -40,7 +41,7 @@ class UserRechargeDao extends BaseDao
|
||||
public function createOrderId($uid)
|
||||
{
|
||||
$count = (int)UserRecharge::getDB()->where('uid', $uid)->where('create_time', '>=', date("Y-m-d"))->where('create_time', '<', date("Y-m-d", strtotime('+1 day')))->count();
|
||||
return 'wx' . date('YmdHis', time()) . ($uid . $count);
|
||||
return StoreOrderRepository::TYPE_SN_USER_RECHARGE . date('YmdHis', time()) . ($uid . $count);
|
||||
}
|
||||
|
||||
public function userRechargePrice($uid)
|
||||
|
@ -43,7 +43,7 @@ class MerchantCheckBaseInfoMiddleware extends BaseMiddleware
|
||||
if ($cache->has($key)) return;
|
||||
|
||||
|
||||
if (!$merchant->mer_avatar || !$merchant->mer_banner || !$merchant->mer_info || !$merchant->service_phone || !$merchant->mer_address) {
|
||||
if (!$merchant->mer_avatar || !$merchant->mer_banner || !$merchant->mer_info || !$merchant->mer_address) {
|
||||
throw new ValidateException('您好,请前往左侧菜单【设置】-【商户基本信息】完善商户基本信息。');
|
||||
}
|
||||
Cache::store('file')->set('mer_valid_' . $merchant->mer_id, 1, 3600 * 8);
|
||||
|
@ -61,8 +61,6 @@ class ServiceTokenMiddleware extends BaseMiddleware
|
||||
throw new AuthException('账号不存在');
|
||||
if (!$admin['is_open'])
|
||||
throw new AuthException('账号未开启');
|
||||
if (!$admin['status'])
|
||||
throw new AuthException('账号已被禁用');
|
||||
if($admin->mer_id){
|
||||
if (!$admin->merchant)
|
||||
throw new AuthException('商户不存在');
|
||||
@ -100,6 +98,9 @@ class ServiceTokenMiddleware extends BaseMiddleware
|
||||
$request->macro('adminInfo', function () use (&$admin) {
|
||||
return $admin;
|
||||
});
|
||||
$request->macro('userType', function () use (&$merchant) {
|
||||
return 4;
|
||||
});
|
||||
}
|
||||
|
||||
public function after(Response $response)
|
||||
|
@ -93,7 +93,7 @@ class StoreCart extends BaseModel
|
||||
|
||||
public function getProductDiscountAttrAttr()
|
||||
{
|
||||
return app()->make(ProductSkuRepository::class)->getSearch(['active_id' => $this->source_id, 'unique' => $this->product_attr_unique])->find();
|
||||
return app()->make(ProductSkuRepository::class)->getSearch(['active_id' => $this->source_id, 'unique' => $this->product_attr_unique,'active_type'=> 10])->find();
|
||||
}
|
||||
|
||||
public function productAssistSet()
|
||||
|
@ -130,6 +130,12 @@ class StoreOrder extends BaseModel
|
||||
return $this->hasOne(StoreOrderProfitsharing::class, 'order_id', 'order_id')->where('type', 'presell');
|
||||
}
|
||||
|
||||
// 核销订单的自订单列表
|
||||
public function takeOrderList()
|
||||
{
|
||||
return $this->hasMany(self::class,'main_id','order_id')->order('verify_time DESC');
|
||||
}
|
||||
|
||||
public function searchMerIdAttr($query, $value)
|
||||
{
|
||||
return $query->where('mer_id', $value);
|
||||
@ -143,7 +149,7 @@ class StoreOrder extends BaseModel
|
||||
|
||||
public function getOrderExtendAttr($val)
|
||||
{
|
||||
return $val ? json_decode($val, true) : [];
|
||||
return $val ? json_decode($val, true) : null;
|
||||
}
|
||||
|
||||
public function getRefundExtensionOneAttr()
|
||||
|
@ -79,7 +79,10 @@ class StoreRefundOrder extends BaseModel
|
||||
'order_sn' => $this->order->order_sn,
|
||||
'refund_order_sn' => $this->refund_order_sn,
|
||||
'refund_price' => $this->refund_price,
|
||||
'pay_price' => $this->order->pay_price
|
||||
'pay_price' => $this->order->pay_price,
|
||||
'refund_message' => $this->refund_message,
|
||||
'open_id' => $this->user->wechat->routine_openid ?? null,
|
||||
'transaction_id' => $this->order->transaction_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class Product extends BaseModel
|
||||
} else {
|
||||
$org_extension = bcmul(($this->attrValue()->order('price DESC')->value('price')) , systemConfig('extension_one_rate'),2);
|
||||
}
|
||||
$spreadUser = (request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null;
|
||||
$spreadUser = (request()->hasMacro('isLogin') && request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null;
|
||||
if ($spreadUser && $spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) {
|
||||
$org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2);
|
||||
}
|
||||
@ -90,7 +90,7 @@ class Product extends BaseModel
|
||||
} else {
|
||||
$org_extension = bcmul(($this->attrValue()->order('price ASC')->value('price')) , systemConfig('extension_one_rate'),2);
|
||||
}
|
||||
$spreadUser = (request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null;
|
||||
$spreadUser = (request()->hasMacro('isLogin') && request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null;
|
||||
if ($spreadUser && $spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) {
|
||||
$org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2);
|
||||
}
|
||||
@ -243,84 +243,6 @@ class Product extends BaseModel
|
||||
return $value ? explode(',',$value) : $value;
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------------------------------------------
|
||||
* 关联模型
|
||||
* -----------------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
public function merCateId()
|
||||
{
|
||||
return $this->hasMany(ProductCate::class,'product_id','product_id')->field('product_id,mer_cate_id');
|
||||
}
|
||||
public function attr()
|
||||
{
|
||||
return $this->hasMany(ProductAttr::class,'product_id','product_id');
|
||||
}
|
||||
public function attrValue()
|
||||
{
|
||||
return $this->hasMany(ProductAttrValue::class,'product_id','product_id');
|
||||
}
|
||||
public function oldAttrValue()
|
||||
{
|
||||
return $this->hasMany(ProductAttrValue::class,'product_id','old_product_id');
|
||||
}
|
||||
public function content()
|
||||
{
|
||||
return $this->hasOne(ProductContent::class,'product_id','product_id');
|
||||
}
|
||||
protected function temp()
|
||||
{
|
||||
return $this->hasOne(ShippingTemplate::class,'shipping_template_id','temp_id');
|
||||
}
|
||||
public function storeCategory()
|
||||
{
|
||||
return $this->hasOne(StoreCategory::class,'store_category_id','cate_id')->field('store_category_id,cate_name');
|
||||
}
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class,'mer_id','mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count');
|
||||
}
|
||||
public function reply()
|
||||
{
|
||||
return $this->hasMany(ProductReply::class,'product_id','product_id')->order('create_time DESC');
|
||||
}
|
||||
public function brand()
|
||||
{
|
||||
return $this->hasOne(StoreBrand::class,'brand_id','brand_id')->field('brand_id,brand_name');
|
||||
}
|
||||
public function seckillActive()
|
||||
{
|
||||
return $this->hasOne(StoreSeckillActive::class,'product_id','product_id');
|
||||
}
|
||||
public function issetCoupon()
|
||||
{
|
||||
return $this->hasOne(StoreCouponProduct::class, 'product_id', 'product_id')->alias('A')
|
||||
->rightJoin('StoreCoupon B', 'A.coupon_id = B.coupon_id')->where(function (BaseQuery $query) {
|
||||
$query->where('B.is_limited', 0)->whereOr(function (BaseQuery $query) {
|
||||
$query->where('B.is_limited', 1)->where('B.remain_count', '>', 0);
|
||||
});
|
||||
})->where(function (BaseQuery $query) {
|
||||
$query->where('B.is_timeout', 0)->whereOr(function (BaseQuery $query) {
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$query->where('B.is_timeout', 1)->where('B.start_time', '<', $time)->where('B.end_time', '>', $time);
|
||||
});
|
||||
})->field('A.product_id,B.*')->where('status', 1)->where('type', 1)->where('send_type', 0)->where('is_del', 0)
|
||||
->order('sort DESC,coupon_id DESC')->hidden(['is_del', 'status']);
|
||||
}
|
||||
public function assist()
|
||||
{
|
||||
return $this->hasOne(ProductAssist::class,'product_id','product_id');
|
||||
}
|
||||
public function productGroup()
|
||||
{
|
||||
return $this->hasOne(ProductGroup::class,'product_id','product_id');
|
||||
}
|
||||
public function guarantee()
|
||||
{
|
||||
return $this->hasOne(GuaranteeTemplate::class,'guarantee_template_id','guarantee_template_id')->where('status',1)->where('is_del',0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO 是否是会员
|
||||
* @return bool
|
||||
@ -329,10 +251,10 @@ class Product extends BaseModel
|
||||
*/
|
||||
public function getIsVipAttr()
|
||||
{
|
||||
if (request()->isLogin()) {
|
||||
if (request()->hasMacro('isLogin') && request()->isLogin()) {
|
||||
if (request()->userType() == 1) {
|
||||
$userInfo = request()->userInfo();
|
||||
return $userInfo->is_svip ? true : false;
|
||||
return $userInfo->is_svip > 0 ? true : false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -406,6 +328,103 @@ class Product extends BaseModel
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getIsSvipPriceAttr()
|
||||
{
|
||||
if ($this->product_type == 0 && $this->mer_svip_status != 0) {
|
||||
//默认比例
|
||||
if ($this->svip_price_type == 1) {
|
||||
$rate = merchantConfig($this->mer_id,'svip_store_rate');
|
||||
$svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0;
|
||||
$price = $this->attrValue()->order('price ASC')->value('price');
|
||||
return bcmul($price,$svip_store_rate,2);
|
||||
}
|
||||
//自定义
|
||||
if ($this->svip_price_type == 2) {
|
||||
return $this->getData('svip_price');
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------------------------------------------
|
||||
* 关联模型
|
||||
* -----------------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
public function merCateId()
|
||||
{
|
||||
return $this->hasMany(ProductCate::class,'product_id','product_id')->field('product_id,mer_cate_id');
|
||||
}
|
||||
public function attr()
|
||||
{
|
||||
return $this->hasMany(ProductAttr::class,'product_id','product_id');
|
||||
}
|
||||
public function attrValue()
|
||||
{
|
||||
return $this->hasMany(ProductAttrValue::class,'product_id','product_id');
|
||||
}
|
||||
public function oldAttrValue()
|
||||
{
|
||||
return $this->hasMany(ProductAttrValue::class,'product_id','old_product_id');
|
||||
}
|
||||
public function content()
|
||||
{
|
||||
return $this->hasOne(ProductContent::class,'product_id','product_id');
|
||||
}
|
||||
protected function temp()
|
||||
{
|
||||
return $this->hasOne(ShippingTemplate::class,'shipping_template_id','temp_id');
|
||||
}
|
||||
public function storeCategory()
|
||||
{
|
||||
return $this->hasOne(StoreCategory::class,'store_category_id','cate_id')->field('store_category_id,cate_name');
|
||||
}
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class,'mer_id','mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count,is_margin');
|
||||
}
|
||||
public function reply()
|
||||
{
|
||||
return $this->hasMany(ProductReply::class,'product_id','product_id')->order('create_time DESC');
|
||||
}
|
||||
public function brand()
|
||||
{
|
||||
return $this->hasOne(StoreBrand::class,'brand_id','brand_id')->field('brand_id,brand_name');
|
||||
}
|
||||
public function seckillActive()
|
||||
{
|
||||
return $this->hasOne(StoreSeckillActive::class,'product_id','product_id');
|
||||
}
|
||||
public function issetCoupon()
|
||||
{
|
||||
return $this->hasOne(StoreCouponProduct::class, 'product_id', 'product_id')->alias('A')
|
||||
->rightJoin('StoreCoupon B', 'A.coupon_id = B.coupon_id')->where(function (BaseQuery $query) {
|
||||
$query->where('B.is_limited', 0)->whereOr(function (BaseQuery $query) {
|
||||
$query->where('B.is_limited', 1)->where('B.remain_count', '>', 0);
|
||||
});
|
||||
})->where(function (BaseQuery $query) {
|
||||
$query->where('B.is_timeout', 0)->whereOr(function (BaseQuery $query) {
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$query->where('B.is_timeout', 1)->where('B.start_time', '<', $time)->where('B.end_time', '>', $time);
|
||||
});
|
||||
})->field('A.product_id,B.*')->where('status', 1)->where('type', 1)->where('send_type', 0)->where('is_del', 0)
|
||||
->order('sort DESC,coupon_id DESC')->hidden(['is_del', 'status']);
|
||||
}
|
||||
public function assist()
|
||||
{
|
||||
return $this->hasOne(ProductAssist::class,'product_id','product_id');
|
||||
}
|
||||
public function productGroup()
|
||||
{
|
||||
return $this->hasOne(ProductGroup::class,'product_id','product_id');
|
||||
}
|
||||
public function guarantee()
|
||||
{
|
||||
return $this->hasOne(GuaranteeTemplate::class,'guarantee_template_id','guarantee_template_id')->where('status',1)->where('is_del',0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------------------------------------------
|
||||
@ -456,8 +475,9 @@ class Product extends BaseModel
|
||||
}
|
||||
public function searchPidAttr($query, $value)
|
||||
{
|
||||
$cateId = app()->make(StoreCategoryRepository::class)->allChildren(intval($value));
|
||||
$query->whereIn('cate_id', $cateId);
|
||||
$childrenId = app()->make(StoreCategoryRepository::class)->findChildrenId((int)$value);
|
||||
$ids = array_merge($childrenId, [(int)$value]);
|
||||
$query->whereIn('cate_id', $ids);
|
||||
}
|
||||
public function searchStockAttr($query, $value)
|
||||
{
|
||||
|
@ -60,17 +60,27 @@ class ProductAttrValue extends BaseModel
|
||||
return $this->getData('svip_price');
|
||||
}
|
||||
|
||||
public function getIsSvipPriceAttr()
|
||||
{
|
||||
if ($this->product->product_type == 0 && $this->product->svip_price_type == 1) {
|
||||
$rate = merchantConfig($this->product->mer_id,'svip_store_rate');
|
||||
$svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0;
|
||||
return bcmul($this->price, $svip_store_rate,2);
|
||||
}
|
||||
return '未设置';
|
||||
}
|
||||
|
||||
public function getBcExtensionOneAttr()
|
||||
{
|
||||
if(!intval(systemConfig('extension_status'))) return 0;
|
||||
if($this->extension_one > 0) return $this->extension_one;
|
||||
if($this->product->extension_type == 1) return $this->extension_one;
|
||||
return floatval(round(bcmul(systemConfig('extension_one_rate'), $this->price, 3),2));
|
||||
}
|
||||
|
||||
public function getBcExtensionTwoAttr()
|
||||
{
|
||||
if(!intval(systemConfig('extension_status'))) return 0;
|
||||
if($this->extension_two > 0) return $this->extension_two;
|
||||
if($this->product->extension_type == 1) return $this->extension_two;
|
||||
return floatval(round(bcmul(systemConfig('extension_two_rate'), $this->price, 3),2));
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,11 @@ class Spu extends BaseModel
|
||||
return $this->product->svip_price;
|
||||
}
|
||||
|
||||
public function getIsSvipPriceAttr()
|
||||
{
|
||||
return $this->product->is_svip_price;
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------------------------------------------
|
||||
* 关联表
|
||||
|
@ -11,6 +11,7 @@
|
||||
namespace app\common\model\store\product;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\repositories\store\product\ProductSkuRepository;
|
||||
|
||||
class StoreDiscountProduct extends BaseModel
|
||||
{
|
||||
@ -32,7 +33,7 @@ class StoreDiscountProduct extends BaseModel
|
||||
|
||||
public function productSku()
|
||||
{
|
||||
return $this->hasMany(ProductSku::class,'active_product_id', 'discount_product_id');
|
||||
return $this->hasMany(ProductSku::class,'active_product_id', 'discount_product_id')->where('active_type',ProductSkuRepository::ACTIVE_TYPE_DISCOUNTS);
|
||||
}
|
||||
|
||||
public function searchProductIdAttr($query, $value)
|
||||
|
@ -55,7 +55,7 @@ class Merchant extends BaseModel
|
||||
if (!$value) return [];
|
||||
return explode(',',$value);
|
||||
}
|
||||
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->hasMany(Product::class, 'mer_id', 'mer_id');
|
||||
@ -66,7 +66,6 @@ class Merchant extends BaseModel
|
||||
return $this->hasMany(SystemConfigValue::class, 'mer_id', 'mer_id');
|
||||
}
|
||||
|
||||
|
||||
public function showProduct()
|
||||
{
|
||||
return $this->hasMany(Product::class, 'mer_id', 'mer_id')
|
||||
@ -85,7 +84,7 @@ class Merchant extends BaseModel
|
||||
{
|
||||
$list = Product::where('mer_id', $this['mer_id'])
|
||||
->where((new ProductDao())->productShow())
|
||||
->field('mer_id,product_id,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id,unit_name')
|
||||
->field('mer_id,product_id,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id')
|
||||
->order('sort DESC, create_time DESC')
|
||||
->limit(3)
|
||||
->select()->append(['show_svip_info']);
|
||||
|
@ -209,14 +209,17 @@ class User extends BaseModel
|
||||
public function service()
|
||||
{
|
||||
return $this->hasOne(StoreService::class, 'uid', 'uid')
|
||||
->where('mer_id', '<>', 0)->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods')->where('is_del', 0)->where('status', 1)
|
||||
->where('mer_id', '<>', 0)
|
||||
->where('is_del', 0)
|
||||
->where('is_open', 1)
|
||||
->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods,is_open')
|
||||
->order('is_verify DESC,customer DESC');
|
||||
}
|
||||
|
||||
public function topService()
|
||||
{
|
||||
return $this->hasOne(StoreService::class, 'uid', 'uid')
|
||||
->where('mer_id', 0)->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods')->where('is_del', 0)->where('status', 1)
|
||||
->where('mer_id', 0)->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods')->where('is_del', 0)
|
||||
->order('is_verify DESC,customer DESC');
|
||||
}
|
||||
|
||||
|
@ -32,4 +32,15 @@ class UserExtract extends BaseModel
|
||||
return $this->hasOne(User::class,'uid','uid');
|
||||
}
|
||||
|
||||
public function searchUidAttr($query, $value)
|
||||
{
|
||||
$query->where('uid',$value);
|
||||
}
|
||||
|
||||
public function searchExtractTypeAttr($query, $value)
|
||||
{
|
||||
$query->where('extract_type',$value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ class CommunityRepository extends BaseRepository
|
||||
$where['uid'] = $userInfo->uid;
|
||||
$where['community_ids'] = $this->dao->joinUser($where)->column('community_id');
|
||||
} else { // 条件视频
|
||||
if ($first) $where['topic_id'] = $first['topic_id'];
|
||||
if (!isset($where['uid']) && $first) $where['topic_id'] = $first['topic_id'];
|
||||
}
|
||||
$where['not_id'] = $where['community_id'];
|
||||
unset($where['community_id']);
|
||||
@ -307,22 +307,26 @@ class CommunityRepository extends BaseRepository
|
||||
foreach ($where as $item) {
|
||||
switch ($item['product_type']){
|
||||
case 0:
|
||||
$id = $item['product_id'];
|
||||
$sid = $item['product_id'];
|
||||
// nobreak;
|
||||
case 1:
|
||||
$id = $item['product_id'];
|
||||
$sid = $item['product_id'];
|
||||
break;
|
||||
case 2:
|
||||
$id = $item['activity_id'];
|
||||
$sid = $item['activity_id'];
|
||||
break;
|
||||
case 3:
|
||||
$id = $item['cart_info']['productAssistSet']['product_assist_id'];
|
||||
$sid = $item['cart_info']['productAssistSet']['product_assist_id'];
|
||||
break;
|
||||
case 4:
|
||||
$id = $item['cart_info']['product']['productGroup']['product_group_id'];
|
||||
$sid = $item['cart_info']['product']['productGroup']['product_group_id'];
|
||||
break;
|
||||
default:
|
||||
$sid = $item['product_id'];
|
||||
break;
|
||||
|
||||
}
|
||||
$data[] = $make->getSpuData($id, $item['product_type'],0);
|
||||
$data[] = $make->getSpuData($sid, $item['product_type'],0);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@ -525,20 +529,21 @@ class CommunityRepository extends BaseRepository
|
||||
{
|
||||
$where = array_merge(['spu_id' => $spuId], self::IS_SHOW_WHERE);
|
||||
return $this->dao->getSearch($where)
|
||||
->field('community_id,title,image')
|
||||
->order('create_time DESC')
|
||||
->field('community_id,title,image,is_type')
|
||||
->limit(3)->select();
|
||||
}
|
||||
|
||||
public function qrcode($id, $type,$user)
|
||||
{
|
||||
$res = $this->dao->search(['is_type' => self::COMMUNIT_TYPE_VIDEO,'community_id' => $id])->find();
|
||||
if (!$res) throw new ValidateException('数据不存在');
|
||||
$res = $this->dao->search(['is_type' => self::COMMUNIT_TYPE_VIDEO,'community_id' => $id, 'status' => 1, 'is_show' => 1])->find();
|
||||
if (!$res) return false;
|
||||
$make = app()->make(QrcodeService::class);
|
||||
if ($type == 'routine') {
|
||||
$name = md5('rcwx' . $id . $type . $user->uid . $user['is_promoter'] . date('Ymd')) . '.jpg';
|
||||
$params = 'id=' . $id . '&spid=' . $user['uid'];
|
||||
$link = '/pages/short_video/nvueSwiper/index?id=';
|
||||
$make->getRoutineQrcodePath($name, $link, $params);
|
||||
$link = 'pages/short_video/nvueSwiper/index';
|
||||
return $make->getRoutineQrcodePath($name, $link, $params);
|
||||
} else {
|
||||
$name = md5('cwx' . $id . $type . $user->uid . $user['is_promoter'] . date('Ymd')) . '.jpg';
|
||||
$link = 'pages/short_video/nvueSwiper/index';
|
||||
|
@ -145,8 +145,16 @@ class DeliveryOrderRepository extends BaseRepository
|
||||
$res = DeliverySevices::create($order['station_type'])->cancelOrder($data);
|
||||
$deduct_fee = $res['deduct_fee'] ?? 0;
|
||||
$this->cancelAfter($order, $deduct_fee, $mark);
|
||||
//订单记录
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$statusRepository->status($order['order_id'], $statusRepository::ORDER_DELIVERY_CITY_CANCEL, '已取消');
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => '同城配送订单已取消',
|
||||
'change_type' => $statusRepository::ORDER_DELIVERY_CITY_CANCEL,
|
||||
];
|
||||
$statusRepository->createAdminLog($orderStatus);
|
||||
});
|
||||
}
|
||||
|
||||
@ -283,20 +291,27 @@ class DeliveryOrderRepository extends BaseRepository
|
||||
$res->status = $status;
|
||||
$res->reason = $reason;
|
||||
$res->save();
|
||||
|
||||
$message = '订单已配送【'. $this->statusData[$status].'】';
|
||||
app()->make(StoreOrderStatusRepository::class)->status($res['order_id'], $this->message[$status], $message);
|
||||
|
||||
if ($status == 2 && !empty($data)) $make->update($res['order_id'],$data);
|
||||
|
||||
|
||||
//订单记录
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$message = '订单同城配送【'. $this->statusData[$status].'】';
|
||||
$orderStatus = [
|
||||
'order_id' => $orderData['order_id'],
|
||||
'order_sn' => $orderData['order_sn'],
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => $message,
|
||||
'change_type' => $this->message[$status],
|
||||
];
|
||||
$statusRepository->createSysLog($orderStatus);
|
||||
if ($status == 2 && !empty($data))
|
||||
$make->update($res['order_id'],$data);
|
||||
if ($status == 4){
|
||||
$order = $make->get($res['order_id']);
|
||||
$user = app()->make(UserRepository::class)->get($order['uid']);
|
||||
$make->update($res['order_id'],['status' => 2]);
|
||||
$make->takeAfter($order, $user);
|
||||
}
|
||||
if ($status == -1) $this->cancelAfter($res, $deductFee , $reason);
|
||||
if ($status == -1)
|
||||
$this->cancelAfter($res, $deductFee , $reason);
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,11 +329,16 @@ class DeliveryOrderRepository extends BaseRepository
|
||||
//地址转经纬度
|
||||
try{
|
||||
$addres = lbs_address($station['city_name'], $order['user_address']);
|
||||
if($type == DeliverySevices::DELIVERY_TYPE_UU) {
|
||||
[$location['lng'],$location['lat']] = gcj02ToBd09($addres['location']['lng'],$addres['location']['lat']);
|
||||
} else {
|
||||
$location = $addres['location'];
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
throw new ValidateException('获取经纬度失败');
|
||||
}
|
||||
|
||||
$getPriceParams = $this->getPriceParams($station, $order, $addres['location'],$type);
|
||||
$getPriceParams = $this->getPriceParams($station, $order,$location,$type);
|
||||
$orderSn = $this->getOrderSn();
|
||||
$getPriceParams['origin_id'] = $orderSn;
|
||||
$getPriceParams['callback_url'] = $callback_url;
|
||||
|
@ -259,7 +259,7 @@ class BroadcastGoodsRepository extends BaseRepository
|
||||
|
||||
$goods = $goods->toArray();
|
||||
$miniProgramService = MiniProgramService::create();
|
||||
$path = app()->make(DownloadImageService::class)->downloadImage($goods['cover_img'])['path'];
|
||||
$path = './public' . app()->make(DownloadImageService::class)->downloadImage($goods['cover_img'],'def','',1)['path'];
|
||||
$data = [
|
||||
'name' => $goods['name'],
|
||||
'priceType' => 1,
|
||||
@ -278,7 +278,7 @@ class BroadcastGoodsRepository extends BaseRepository
|
||||
public function wxUpdate($id,$data)
|
||||
{
|
||||
$miniProgramService = MiniProgramService::create();
|
||||
$path = app()->make(DownloadImageService::class)->downloadImage($data['cover_img'])['path'];
|
||||
$path = './public' . app()->make(DownloadImageService::class)->downloadImage($data['cover_img'],'def','',1)['path'];
|
||||
$params = [
|
||||
"goodsId" => $id,
|
||||
'name' => $data['name'],
|
||||
|
@ -201,7 +201,7 @@ class BroadcastRoomRepository extends BaseRepository
|
||||
{
|
||||
return Elm::createForm(Route::buildUrl('systemBroadcastRoomApply', compact('id'))->build(), [
|
||||
Elm::radio('status', '审核状态', '1')->options([['value' => '-1', 'label' => '未通过'], ['value' => '1', 'label' => '通过']])->control([
|
||||
['value' => -1, 'rule' => [
|
||||
['value' => '-1', 'rule' => [
|
||||
Elm::textarea('msg', '未通过原因', '信息有误,请完善')->required()
|
||||
]]
|
||||
]),
|
||||
@ -251,9 +251,10 @@ class BroadcastRoomRepository extends BaseRepository
|
||||
|
||||
$room = $room->toArray();
|
||||
$miniProgramService = MiniProgramService::create();
|
||||
$coverImg = app()->make(DownloadImageService::class)->downloadImage($room['cover_img'])['path'];
|
||||
$shareImg = app()->make(DownloadImageService::class)->downloadImage($room['share_img'])['path'];
|
||||
$feedsImg = app()->make(DownloadImageService::class)->downloadImage($room['feeds_img'])['path'];
|
||||
$DownloadImageService = app()->make(DownloadImageService::class);
|
||||
$coverImg = './public' . $DownloadImageService->downloadImage($room['cover_img'],'def','',1)['path'];
|
||||
$shareImg = './public' . $DownloadImageService->downloadImage($room['share_img'],'def','',1)['path'];
|
||||
$feedsImg = './public' . $DownloadImageService->downloadImage($room['feeds_img'],'def','',1)['path'];
|
||||
$data = [
|
||||
'startTime' => strtotime($room['start_time']),
|
||||
'endTime' => strtotime($room['end_time']),
|
||||
@ -268,12 +269,9 @@ class BroadcastRoomRepository extends BaseRepository
|
||||
'closeKf' => $room['close_kf'],
|
||||
'closeReplay' => $room['replay_status'] == 1 ? 0 : 1,
|
||||
'isFeedsPublic' => $room['is_feeds_public'] == 1 ? 0 : 1,
|
||||
// 'coverImg' => $miniProgramService->material()->uploadImage($coverImg)->media_id,
|
||||
// 'shareImg' => $miniProgramService->material()->uploadImage($shareImg)->media_id,
|
||||
// 'feedsImg' => $miniProgramService->material()->uploadImage($feedsImg)->media_id,
|
||||
'coverImg' => $coverImg,
|
||||
'shareImg' => $shareImg,
|
||||
'feedsImg' => $feedsImg,
|
||||
'coverImg' => $miniProgramService->material()->uploadImage($coverImg)->media_id,
|
||||
'shareImg' => $miniProgramService->material()->uploadImage($shareImg)->media_id,
|
||||
'feedsImg' => $miniProgramService->material()->uploadImage($feedsImg)->media_id,
|
||||
];
|
||||
@unlink($coverImg);
|
||||
@unlink($shareImg);
|
||||
|
@ -333,12 +333,18 @@ class StoreCouponRepository extends BaseRepository
|
||||
'coupon_id' => $coupon['coupon_id'],
|
||||
'mer_id' => $coupon['mer_id']
|
||||
];
|
||||
if ($coupon['coupon_type'] == 1) {
|
||||
$data['start_time'] = $coupon['use_start_time'];
|
||||
$data['end_time'] = $coupon['use_end_time'];
|
||||
if ($coupon['send_type'] == self::GET_COUPON_TYPE_SVIP) {
|
||||
$data['start_time'] = date('Y-m-d 00:00:00',time());
|
||||
$firstday = date('Y-m-01', time());
|
||||
$data['end_time'] = date('Y-m-d 23:59:59', strtotime("$firstday +1 month -1 day"));
|
||||
} else {
|
||||
$data['start_time'] = date('Y-m-d H:i:s');
|
||||
$data['end_time'] = date('Y-m-d H:i:s', strtotime("+ {$coupon['coupon_time']}day"));
|
||||
if ($coupon['coupon_type'] == 1) {
|
||||
$data['start_time'] = $coupon['use_start_time'];
|
||||
$data['end_time'] = $coupon['use_end_time'];
|
||||
} else {
|
||||
$data['start_time'] = date('Y-m-d H:i:s');
|
||||
$data['end_time'] = date('Y-m-d H:i:s', strtotime("+ {$coupon['coupon_time']}day"));
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
@ -52,19 +52,6 @@ class PresellOrderRepository extends BaseRepository
|
||||
$this->dao = $dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author xaboy
|
||||
* @day 2020/6/9
|
||||
*/
|
||||
public function getNewOrderId()
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = 'ps' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
|
||||
public function createOrder($uid, $orderId, $price, $final_start_time, $final_end_time)
|
||||
{
|
||||
return $this->dao->create([
|
||||
@ -73,7 +60,7 @@ class PresellOrderRepository extends BaseRepository
|
||||
'final_start_time' => $final_start_time,
|
||||
'final_end_time' => $final_end_time,
|
||||
'pay_price' => $price,
|
||||
'presell_order_sn' => $this->getNewOrderId()
|
||||
'presell_order_sn' => app()->make(StoreOrderRepository::class)->getNewOrderId(StoreOrderRepository::TYPE_SN_PRESELL)
|
||||
]);
|
||||
}
|
||||
|
||||
@ -142,12 +129,15 @@ class PresellOrderRepository extends BaseRepository
|
||||
}
|
||||
$order->order->save();
|
||||
$order->save();
|
||||
//订单记录
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单尾款支付成功',
|
||||
'change_type' => 'presell'
|
||||
'change_type' => $statusRepository::ORDER_STATUS_PRESELL,
|
||||
];
|
||||
|
||||
$i = 1;
|
||||
$finance = [];
|
||||
|
||||
@ -284,7 +274,7 @@ class PresellOrderRepository extends BaseRepository
|
||||
app()->make(ProductPresellSkuRepository::class)->incCount($order->order->orderProduct[0]['activity_id'], $order->order->orderProduct[0]['product_sku'], 'two_pay');
|
||||
app()->make(UserMerchantRepository::class)->updatePayTime($order->uid, $order->mer_id, $order->pay_price, false);
|
||||
app()->make(FinancialRecordRepository::class)->insertAll($finance);
|
||||
app()->make(StoreOrderStatusRepository::class)->create($orderStatus);
|
||||
$statusRepository->createUserLog($orderStatus);
|
||||
});
|
||||
if ($order->user->spread_uid) {
|
||||
Queue::push(UserBrokerageLevelJob::class, ['uid' => $order->user->spread_uid, 'type' => 'spread_money', 'inc' => $order->pay_price]);
|
||||
@ -297,19 +287,23 @@ class PresellOrderRepository extends BaseRepository
|
||||
{
|
||||
$order = $this->dao->getWhere(['presell_order_id' => $id, 'paid' => 0]);
|
||||
if (!$order) return;
|
||||
//订单记录
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => '预售订单超时支付自动关闭',
|
||||
'change_type' => 'presell_close'
|
||||
'change_type' => $statusRepository::ORDER_STATUS_PRESELL_CLOSE,
|
||||
];
|
||||
event('order.presll.fail.before', compact('order'));
|
||||
$productRepository = app()->make(ProductRepository::class);
|
||||
Db::transaction(function () use ($productRepository, $order, $orderStatus) {
|
||||
app()->make(StoreOrderStatusRepository::class)->create($orderStatus);
|
||||
Db::transaction(function () use ($productRepository, $order, $orderStatus,$statusRepository) {
|
||||
$statusRepository->createSysLog($orderStatus);
|
||||
$order->order->status = 11;
|
||||
$order->status = 0;
|
||||
$order->save();
|
||||
$order->save();+
|
||||
$order->order->save();
|
||||
foreach ($order->order->orderProduct as $cart) {
|
||||
$productRepository->orderProductIncStock($order->order, $cart);
|
||||
|
@ -143,7 +143,8 @@ class StoreGroupOrderRepository extends BaseRepository
|
||||
'balance' => $make->get($groupOrder->uid)->integral
|
||||
]);
|
||||
}
|
||||
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
foreach ($groupOrder->orderList as $order) {
|
||||
if ($order->activity_type == 3 && $order->presellOrder) {
|
||||
$order->presellOrder->status = 0;
|
||||
@ -153,12 +154,17 @@ class StoreGroupOrderRepository extends BaseRepository
|
||||
$order->save();
|
||||
$orderStatus[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'change_type' => 'cancel',
|
||||
'change_message' => '取消订单' . ($uid ? '' : '[自动]')
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '取消订单' . ($uid ? '' : '[自动]'),
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_CANCEL,
|
||||
'uid' => 0,
|
||||
'nickname' => '系统',
|
||||
'user_type' => $storeOrderStatusRepository::U_TYPE_SYSTEM,
|
||||
];
|
||||
}
|
||||
$groupOrder->save();
|
||||
app()->make(StoreOrderStatusRepository::class)->insertAll($orderStatus);
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
});
|
||||
Queue::push(CancelGroupOrderJob::class, $id);
|
||||
}
|
||||
|
@ -1063,7 +1063,7 @@ class StoreOrderCreateDgRepository extends StoreOrderRepository
|
||||
'is_virtual' => $order_model ? 1 : 0,
|
||||
'extension_one' => $total_extension_one,
|
||||
'extension_two' => $total_extension_two,
|
||||
'order_sn' => $this->getNewOrderId() . ($k + 1),
|
||||
'order_sn' => $this->getNewOrderId('dg') . ($k + 1),
|
||||
'uid' => $uid,
|
||||
'spread_uid' => $spreadUid,
|
||||
'top_uid' => $topUid,
|
||||
@ -1098,7 +1098,7 @@ class StoreOrderCreateDgRepository extends StoreOrderRepository
|
||||
}
|
||||
$groupOrder = [
|
||||
'uid' => $uid,
|
||||
'group_order_sn' => count($orderList) === 1 ? $orderList[0]['order_sn'] : ($this->getNewOrderId() . '0'),
|
||||
'group_order_sn' => count($orderList) === 1 ? $orderList[0]['order_sn'] : ($this->getNewOrderId('dg') . '0'),
|
||||
'total_postage' => $totalPostage,
|
||||
'total_price' => $orderInfo['total_price'],
|
||||
'total_num' => $totalNum,
|
||||
@ -1263,7 +1263,7 @@ class StoreOrderCreateDgRepository extends StoreOrderRepository
|
||||
'final_start_time' => $cart['productPresell']['final_start_time'],
|
||||
'final_end_time' => $cart['productPresell']['final_end_time'],
|
||||
'pay_price' => $allFinalPrice,
|
||||
'presell_order_sn' => $presellOrderRepository->getNewOrderId()
|
||||
'presell_order_sn' => $presellOrderRepository->getNewOrderId('dg')
|
||||
]);
|
||||
}
|
||||
app()->make(ProductPresellSkuRepository::class)->incCount($cart['source_id'], $cart['productAttr']['unique'], 'one_take');
|
||||
|
@ -211,6 +211,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
|
||||
if ($cart['product_type'] == 10 && $cart['productDiscountAttr']) {
|
||||
$cart['productAttr']['price'] = $cart['productDiscountAttr']['active_price'];
|
||||
$cart['productAttr']['show_svip_price'] = false;
|
||||
}
|
||||
|
||||
if ($cart['cart_num'] <= 0) {
|
||||
@ -221,11 +222,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$price = bcmul($cart['cart_num'], $this->cartByPrice($cart), 2);
|
||||
$cart['total_price'] = $price;
|
||||
$cart['postage_price'] = 0;
|
||||
$cart['svip_discount'] = 0;
|
||||
$total_price = bcadd($total_price, $price, 2);
|
||||
$total_num += $cart['cart_num'];
|
||||
$_price = bcmul($cart['cart_num'], $this->cartByCouponPrice($cart), 2);
|
||||
$cart['svip_coupon_merge'] = 1;
|
||||
if ($cart['productAttr']['show_svip_price']) {
|
||||
if ($cart['productAttr']['show_svip_price'] && !$cart['product_type']) {
|
||||
$svip_discount = max(bcmul($cart['cart_num'], bcsub($cart['productAttr']['org_price'] ?? 0, $cart['productAttr']['price'], 2), 2), 0);
|
||||
if ($svip_coupon_merge != '1') {
|
||||
$_price = 0;
|
||||
@ -237,6 +239,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$cart['allow_price'] = $_price;
|
||||
$temp1 = $cart['product']['temp'];
|
||||
$cart['temp_number'] = 0;
|
||||
$total_svip_discount = bcadd($total_svip_discount, $svip_discount, 2);
|
||||
$cart['svip_discount'] = $svip_discount;
|
||||
|
||||
if (!isset($product_cart[$cart['product_id']]))
|
||||
$product_cart[$cart['product_id']] = [$cart['cart_id']];
|
||||
@ -315,7 +319,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$postageRule[$tempId]['region'] = $regionRule;
|
||||
}
|
||||
unset($cart);
|
||||
$total_svip_discount = bcadd($total_svip_discount, $svip_discount, 2);
|
||||
|
||||
if (!$isTake) {
|
||||
//计算运费
|
||||
@ -522,11 +525,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//单个商品实际支付金额
|
||||
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
|
||||
$cart['true_price'] = $cartTotalPrice;
|
||||
$cart['svip_discount'] = $svip_discount;
|
||||
}
|
||||
unset($cart, $_k);
|
||||
$total_true_price = bcadd($_pay_price, $total_true_price, 2);
|
||||
$orderDeliveryStatus = $orderDeliveryStatus && $deliveryStatus;
|
||||
if(count($merchantCartList) > 1 || count($merchantCart['list']) > 1){
|
||||
$orderDeliveryStatus = $orderDeliveryStatus && $deliveryStatus;
|
||||
}
|
||||
$merchantCart['order'] = [
|
||||
'true_price' => $_pay_price,
|
||||
'platform_coupon_price' => 0,
|
||||
@ -921,7 +925,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
$orderType = $orderInfo['order_type'];
|
||||
|
||||
if ($orderType && $orderType< 98 && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) {
|
||||
if ($orderType && $orderType<=98 && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) {
|
||||
throw new ValidateException('活动商品请单独购买');
|
||||
}
|
||||
|
||||
@ -1106,7 +1110,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'is_virtual' => $is_virtual,
|
||||
'extension_one' => $total_extension_one,
|
||||
'extension_two' => $total_extension_two,
|
||||
'order_sn' => $this->getNewOrderId() . ($k + 1),
|
||||
'order_sn' => $this->getNewOrderId('wx') . ($k + 1),
|
||||
'uid' => $uid,
|
||||
'spread_uid' => $spreadUid,
|
||||
'top_uid' => $topUid,
|
||||
@ -1191,7 +1195,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'commission_rate' => $shareRate,
|
||||
'order_type' => $merchantCart['order']['isTake'] ? 1 : 0,
|
||||
'is_virtual' => $order_model ? 1 : 0,
|
||||
'order_sn' => $this->getNewOrderId() . ($k + 1),
|
||||
'order_sn' => $this->getNewOrderId('wx') . ($k + 1),
|
||||
'uid' => $uid,
|
||||
'spread_uid' => $spreadUid,
|
||||
'top_uid' => $topUid,
|
||||
@ -1234,7 +1238,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
|
||||
$groupOrder = [
|
||||
'uid' => $uid,
|
||||
'group_order_sn' => count($orderList) === 1 ? $orderList[0]['order_sn'] : ($this->getNewOrderId() . '0'),
|
||||
'group_order_sn' => count($orderList) === 1 ? $orderList[0]['order_sn'] : ($this->getNewOrderId(StoreOrderRepository::TYPE_SN_ORDER) . '0'),
|
||||
'is_virtual' => $order_model ? 1 : 0,
|
||||
'total_postage' => $totalPostage,
|
||||
'total_price' => $orderInfo['total_price'],
|
||||
@ -1262,6 +1266,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$productRepository = app()->make(ProductRepository::class);
|
||||
$storeOrderProductRepository = app()->make(StoreOrderProductRepository::class);
|
||||
$couponUserRepository = app()->make(StoreCouponUserRepository::class);
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$userMerchantRepository = app()->make(UserMerchantRepository::class);
|
||||
|
||||
@ -1372,8 +1377,13 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
|
||||
$orderStatus[] = [
|
||||
'order_id' => $_order->order_id,
|
||||
'order_sn' => $_order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单生成',
|
||||
'change_type' => 'create'
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_CREATE,
|
||||
'uid' => $user->uid,
|
||||
'nickname' => $user->nickname,
|
||||
'user_type' => $storeOrderStatusRepository::U_TYPE_USER,
|
||||
];
|
||||
|
||||
foreach ($cartInfo['list'] as $cart) {
|
||||
@ -1401,7 +1411,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'final_start_time' => $cart['productPresell']['final_start_time'],
|
||||
'final_end_time' => $cart['productPresell']['final_end_time'],
|
||||
'pay_price' => $allFinalPrice,
|
||||
'presell_order_sn' => $presellOrderRepository->getNewOrderId()
|
||||
'presell_order_sn' => $this->getNewOrderId(StoreOrderRepository::TYPE_SN_PRESELL)
|
||||
]);
|
||||
}
|
||||
app()->make(ProductPresellSkuRepository::class)->incCount($cart['source_id'], $cart['productAttr']['unique'], 'one_take');
|
||||
@ -1463,7 +1473,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if (count($bills) > 0) {
|
||||
app()->make(UserBillRepository::class)->insertAll($bills);
|
||||
}
|
||||
$storeOrderStatusRepository->insertAll($orderStatus);
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
$storeOrderProductRepository->insertAll($orderProduct);
|
||||
event('order.create', compact('groupOrder'));
|
||||
return $groupOrder;
|
||||
|
@ -51,6 +51,7 @@ use crmeb\services\SwooleTaskService;
|
||||
use Exception;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use FormBuilder\Form;
|
||||
use http\Exception\InvalidArgumentException;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
@ -75,6 +76,12 @@ class StoreOrderRepository extends BaseRepository
|
||||
*/
|
||||
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr'];
|
||||
|
||||
const TYPE_SN_ORDER = 'wxo';
|
||||
const TYPE_SN_PRESELL = 'wxp';
|
||||
const TYPE_SN_USER_ORDER = 'wxs';
|
||||
const TYPE_SN_USER_RECHARGE = 'wxu';
|
||||
|
||||
const TYPE_SN_REFUND = 'rwx';
|
||||
/**
|
||||
* StoreOrderRepository constructor.
|
||||
* @param StoreOrderDao $dao
|
||||
@ -114,10 +121,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额支付
|
||||
* @param User $user
|
||||
* @param StoreGroupOrder $groupOrder
|
||||
* @return mixed
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/9
|
||||
*/
|
||||
@ -127,21 +133,20 @@ class StoreOrderRepository extends BaseRepository
|
||||
throw new ValidateException('未开启余额支付');
|
||||
if ($user['now_money'] < $groupOrder['pay_price'])
|
||||
throw new ValidateException('余额不足,请更换支付方式');
|
||||
|
||||
Db::transaction(function () use ($user, $groupOrder) {
|
||||
$user->now_money = bcsub($user->now_money, $groupOrder['pay_price'], 2);
|
||||
$user->save();
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$userBillRepository->decBill($user['uid'], 'now_money', 'pay_product', [
|
||||
'link_id' => $groupOrder['group_order_id'],
|
||||
'status' => 1,
|
||||
'title' => '购买商品',
|
||||
'number' => $groupOrder['pay_price'],
|
||||
'mark' => '余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品',
|
||||
'balance' => $user->now_money
|
||||
]);
|
||||
$this->paySuccess($groupOrder);
|
||||
});
|
||||
Db::transaction(function () use ($user, $groupOrder) {
|
||||
$user->now_money = bcsub($user->now_money, $groupOrder['pay_price'], 2);
|
||||
$user->save();
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$userBillRepository->decBill($user['uid'], 'now_money', 'pay_product', [
|
||||
'link_id' => $groupOrder['group_order_id'],
|
||||
'status' => 1,
|
||||
'title' => '购买商品',
|
||||
'number' => $groupOrder['pay_price'],
|
||||
'mark' => '余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品',
|
||||
'balance' => $user->now_money
|
||||
]);
|
||||
$this->paySuccess($groupOrder);
|
||||
});
|
||||
return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||
}
|
||||
|
||||
@ -199,6 +204,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
$uid = $groupOrder->uid;
|
||||
$i = 1;
|
||||
$isVipCoupon = app()->make(StoreGroupOrderRepository::class)->isVipCoupon($groupOrder);
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$svipDiscount = 0;
|
||||
foreach ($groupOrder->orderList as $_k => $order) {
|
||||
$order->paid = 1;
|
||||
@ -241,8 +248,13 @@ class StoreOrderRepository extends BaseRepository
|
||||
$order->save();
|
||||
$orderStatus[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单支付成功',
|
||||
'change_type' => 'pay_success'
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_PAY_SUCCCESS,
|
||||
'uid' => $order->uid,
|
||||
'nickname' => $order->user->nickname,
|
||||
'user_type' => $storeOrderStatusRepository::U_TYPE_USER,
|
||||
];
|
||||
|
||||
//TODO 成为推广员
|
||||
@ -437,9 +449,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
// ]);
|
||||
|
||||
if ($groupOrder->user->spread_uid) {
|
||||
Queue::push(UserBrokerageLevelJob::class, ['uid' => $groupOrder->user->spread_uid, 'type' => 'spread_pay_num', 'inc' => 1]);
|
||||
Queue::push(UserBrokerageLevelJob::class, ['uid' => $groupOrder->user->spread_uid, 'type' => 'spread_money', 'inc' => $groupOrder->pay_price]);
|
||||
}
|
||||
|
||||
}
|
||||
app()->make(UserRepository::class)->update($groupOrder->uid, [
|
||||
'pay_count' => Db::raw('pay_count+' . count($groupOrder->orderList)),
|
||||
'pay_price' => Db::raw('pay_price+' . $groupOrder->pay_price),
|
||||
@ -450,7 +462,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$storeOrderProfitsharingRepository->insertAll($profitsharing);
|
||||
}
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
app()->make(StoreOrderStatusRepository::class)->insertAll($orderStatus);
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
if (count($groupOrder['give_coupon_ids']) > 0)
|
||||
$groupOrder['give_coupon_ids'] = app()->make(StoreCouponRepository::class)->getGiveCoupon($groupOrder['give_coupon_ids'])->column('coupon_id');
|
||||
$groupOrder->save();
|
||||
@ -510,11 +522,11 @@ class StoreOrderRepository extends BaseRepository
|
||||
* @author xaboy
|
||||
* @day 2020/6/9
|
||||
*/
|
||||
public function getNewOrderId()
|
||||
public function getNewOrderId($type)
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = 'wx' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
$orderId = $type . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
|
||||
@ -658,7 +670,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
},
|
||||
'receipt' => function ($query) {
|
||||
return $query->field('order_id,order_receipt_id');
|
||||
}
|
||||
},
|
||||
'takeOrderList.orderProduct'
|
||||
];
|
||||
if ($uid) {
|
||||
$where['uid'] = $uid;
|
||||
@ -695,6 +708,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
])
|
||||
->find();
|
||||
if (!$data)
|
||||
throw new ValidateException('数据不存在');
|
||||
if ($data['status'])
|
||||
throw new ValidateException('该订单已全部核销');
|
||||
return $data;
|
||||
@ -722,12 +737,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
*/
|
||||
public function computed(StoreOrder $order, User $user)
|
||||
{
|
||||
|
||||
// \think\facade\Log::record('收获开始~');
|
||||
// \think\facade\Log::record($order);
|
||||
// \think\facade\Log::record('收获结束~');
|
||||
// exit;
|
||||
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
if ($order->spread_uid) {
|
||||
$spreadUid = $order->spread_uid;
|
||||
@ -789,15 +798,11 @@ class StoreOrderRepository extends BaseRepository
|
||||
* @author xaboy
|
||||
* @day 2020/8/3
|
||||
*/
|
||||
public function takeAfter(StoreOrder $order, User $user)
|
||||
public function takeAfter(StoreOrder $order, ?User $user)
|
||||
{
|
||||
|
||||
Db::transaction(function () use ($user, $order) {
|
||||
$this->computed($order, $user);
|
||||
//TODO 确认收货
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
|
||||
$statusRepository->status($order->order_id, $statusRepository::ORDER_STATUS_TAKE, $order->order_type == 1 ? '已核销' :'已收货');
|
||||
if ($user) $this->computed($order, $user);
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_TAKE_SUCCESS', 'id' => $order->order_id]);
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'ADMIN_TAKE_DELIVERY_CODE', 'id' => $order->order_id]);
|
||||
app()->make(MerchantRepository::class)->computedLockMoney($order);
|
||||
@ -821,16 +826,31 @@ class StoreOrderRepository extends BaseRepository
|
||||
throw new ValidateException('订单不存在');
|
||||
if ($order['status'] != 1 || $order['order_type'])
|
||||
throw new ValidateException('订单状态有误');
|
||||
if (!$user) $user = $order->user;
|
||||
if (!$user) {
|
||||
throw new ValidateException('用户不存在');
|
||||
$func = 'createUserLog';
|
||||
if (!$user){
|
||||
$func = 'createSysLog';
|
||||
$user = $order->user;
|
||||
}
|
||||
// if (!$user) {
|
||||
//
|
||||
// throw new ValidateException('用户不存在');
|
||||
// }
|
||||
$order->status = 2;
|
||||
$order->verify_time = date('Y-m-d H:i:s');
|
||||
event('order.take.before', compact('order'));
|
||||
Db::transaction(function () use ($order, $user) {
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '已收货',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_TAKE,
|
||||
];
|
||||
Db::transaction(function () use ($order, $user,$storeOrderStatusRepository,$orderStatus,$func) {
|
||||
$this->takeAfter($order, $user);
|
||||
$order->save();
|
||||
$storeOrderStatusRepository->{$func}($orderStatus);
|
||||
});
|
||||
event('order.take', compact('order'));
|
||||
}
|
||||
@ -1004,7 +1024,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 12/15/20
|
||||
*/
|
||||
public function eidt(int $id, array $data)
|
||||
public function eidt(int $id, array $data, $service_id = 0)
|
||||
{
|
||||
|
||||
/**
|
||||
@ -1039,18 +1059,31 @@ class StoreOrderRepository extends BaseRepository
|
||||
//总单实际支付邮费
|
||||
$_group['pay_postage'] = $this->bcmathPrice($orderGroup['pay_postage'], $order['pay_postage'], $data['pay_postage']);
|
||||
event('order.changePrice.before', compact('order', 'data'));
|
||||
Db::transaction(function () use ($id, $data, $orderGroup, $order, $_group) {
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单价格修改',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_CHANGE,
|
||||
];
|
||||
Db::transaction(function () use ($id, $data, $orderGroup, $order, $_group,$storeOrderStatusRepository,$orderStatus,$service_id) {
|
||||
$orderGroup->total_price = $_group['total_price'];
|
||||
$orderGroup->pay_price = $_group['pay_price'];
|
||||
$orderGroup->pay_postage = $_group['pay_postage'];
|
||||
$orderGroup->group_order_sn = $this->getNewOrderId() . '0';
|
||||
$orderGroup->group_order_sn = $this->getNewOrderId(StoreOrderRepository::TYPE_SN_ORDER) . '0';
|
||||
$orderGroup->save();
|
||||
|
||||
$this->dao->update($id, $data);
|
||||
$this->changOrderProduct($id, $data);
|
||||
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::ORDER_STATUS_CHANGE, '订单信息修改');
|
||||
if ($service_id) {
|
||||
$storeOrderStatusRepository->createServiceLog($service_id,$orderStatus);
|
||||
} else {
|
||||
$storeOrderStatusRepository->createAdminLog($orderStatus);
|
||||
}
|
||||
if ($data['pay_price'] != $order['pay_price']) Queue::push(SendSmsJob::class, ['tempId' => 'PRICE_REVISION_CODE', 'id' => $id]);
|
||||
});
|
||||
event('order.changePrice', compact('order', 'data'));
|
||||
@ -1144,7 +1177,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
'order_id' => $id,
|
||||
];
|
||||
$ret = $this->dao->getWhere($where);
|
||||
if ($ret['is_virtual']!=0 && $ret['is_virtual']<98 ) throw new ValidateException('虚拟商品只能虚拟发货');
|
||||
if ($ret['is_virtual']!=0 && $ret['is_virtual']<=98 ) throw new ValidateException('虚拟商品只能虚拟发货');
|
||||
$cargo = '';
|
||||
$count = 0;
|
||||
foreach ($ret->orderProduct as $item) {
|
||||
@ -1175,7 +1208,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
$make = app()->make(StoreImportDeliveryRepository::class);
|
||||
$data = [];
|
||||
$num = 0;
|
||||
|
||||
foreach ($params['order_id'] as $item) {
|
||||
$ret = $this->dao->getWhere(['order_id' => $params['order_id']]);
|
||||
$imp = [
|
||||
@ -1187,19 +1219,12 @@ class StoreOrderRepository extends BaseRepository
|
||||
'mer_id' => $merId
|
||||
];
|
||||
|
||||
if (
|
||||
!$ret ||
|
||||
$ret['mer_id'] != $merId ||
|
||||
$ret['is_del'] != 0 ||
|
||||
$ret['paid'] != 1 ||
|
||||
$ret['delivery_type'] != 0
|
||||
) {
|
||||
if (!$ret || $ret['status'] != 1 || $ret['mer_id'] != $merId || $ret['is_del'] != 0 || $ret['paid'] != 1 || $ret['delivery_type'] != 0 ) {
|
||||
$imp['status'] = 0;
|
||||
$imp['mark'] = '订单信息不存在或状态错误';
|
||||
} else {
|
||||
|
||||
switch ($params['delivery_type']) {
|
||||
case 4: //电子面单
|
||||
try {
|
||||
if ($params['delivery_type'] == 4) {
|
||||
$dump = [
|
||||
'temp_id' => $params['temp_id'],
|
||||
'from_tel' => $params['from_tel'],
|
||||
@ -1208,31 +1233,21 @@ class StoreOrderRepository extends BaseRepository
|
||||
'delivery_name' => $params['delivery_name'],
|
||||
];
|
||||
$dump = $this->orderDumpInfo($item, $dump, $merId);
|
||||
try {
|
||||
$ret = $this->dump($item, $merId, $dump);
|
||||
$num++;
|
||||
$imp['delivery_id'] = $ret['delivery_id'];
|
||||
$imp['delivery_name'] = $ret['delivery_name'];
|
||||
$imp['status'] = 1;
|
||||
} catch (Exception $exception) {
|
||||
$imp['status'] = 0;
|
||||
$imp['mark'] = $exception->getMessage();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
$this->delivery($item, $merId,[
|
||||
'delivery_id' => $params['delivery_id'],
|
||||
'delivery_type' => $params['delivery_type'],
|
||||
'delivery_name' => $params['delivery_name'],
|
||||
]);
|
||||
$num++;
|
||||
$imp['status'] = 1;
|
||||
} catch (Exception $exception) {
|
||||
$imp['status'] = 0;
|
||||
$imp['mark'] = $exception->getMessage();
|
||||
}
|
||||
break;
|
||||
$ret = $this->dump($item, $merId, $dump);
|
||||
$imp['delivery_id'] = $ret['delivery_id'];
|
||||
$imp['delivery_name'] = $ret['delivery_name'];
|
||||
} else {
|
||||
$this->delivery($item, $merId,[
|
||||
'delivery_id' => $params['delivery_id'],
|
||||
'delivery_type' => $params['delivery_type'],
|
||||
'delivery_name' => $params['delivery_name'],
|
||||
]);
|
||||
}
|
||||
$num++;
|
||||
$imp['status'] = 1;
|
||||
} catch (Exception $exception) {
|
||||
$imp['status'] = 0;
|
||||
$imp['mark'] = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
$data[] = $imp;
|
||||
@ -1254,7 +1269,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 7/26/21
|
||||
*/
|
||||
public function dump(int $id, int $merId, array $data)
|
||||
public function dump(int $id, int $merId, array $data, $service_id = 0)
|
||||
{
|
||||
$make = app()->make(MerchantRepository::class);
|
||||
$make->checkCrmebNum($merId, 'dump');
|
||||
@ -1269,7 +1284,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
'delivery_type' => 4,
|
||||
'delivery_name' => $data['delivery_name'],
|
||||
'delivery_id' => $result['kuaidinum'],
|
||||
'remark' => $data['remark'],
|
||||
'remark' => $data['remark'] ?? '',
|
||||
];
|
||||
|
||||
$dump = [
|
||||
@ -1279,8 +1294,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
'order_sn' => $data['order_sn'],
|
||||
'to_name' => $data['to_name'],
|
||||
];
|
||||
Db::transaction(function () use ($merId, $id, $delivery, $make, $dump) {
|
||||
$this->delivery($id, $merId, $delivery);
|
||||
Db::transaction(function () use ($merId, $id, $delivery, $make, $dump, $service_id) {
|
||||
$this->delivery($id, $merId, $delivery,$service_id);
|
||||
$arr = [
|
||||
'type' => 'mer_dump',
|
||||
'num' => -1,
|
||||
@ -1292,22 +1307,22 @@ class StoreOrderRepository extends BaseRepository
|
||||
return $delivery;
|
||||
}
|
||||
|
||||
public function runDelivery($id, $merId, $data, $split, $method)
|
||||
public function runDelivery($id, $merId, $data, $split, $method,$service_id = 0)
|
||||
{
|
||||
return Db::transaction(function () use ($id, $merId, $data, $split, $method) {
|
||||
return Db::transaction(function () use ($id, $merId, $data, $split, $method,$service_id) {
|
||||
if ($split['is_split'] && !empty($split['split'])) {
|
||||
foreach ($split['split'] as $v) {
|
||||
$splitData[$v['id']] = $v['num'];
|
||||
}
|
||||
$order = $this->dao->get($id);
|
||||
$newOrder = app()->make(StoreOrderSplitRepository::class)->splitOrder($order, $splitData);
|
||||
$newOrder = app()->make(StoreOrderSplitRepository::class)->splitOrder($order, $splitData,$service_id);
|
||||
if ($newOrder){
|
||||
$id = $newOrder->order_id;
|
||||
} else {
|
||||
throw new ValidateException('商品不能全部拆单');
|
||||
}
|
||||
}
|
||||
return $this->{$method}($id, $merId, $data);
|
||||
return $this->{$method}($id, $merId, $data,$service_id);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1319,12 +1334,13 @@ class StoreOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 7/26/21
|
||||
*/
|
||||
public function delivery($id, $merId, $data)
|
||||
public function delivery($id, $merId, $data, $service_id = 0)
|
||||
{
|
||||
$data['status'] = 1;
|
||||
$order = $this->dao->get($id);
|
||||
if ($order['is_virtual'] && $data['delivery_type'] != 3 && $order['is_virtual'] <98)
|
||||
if ($order['is_virtual'] && $data['delivery_type'] != 3)
|
||||
throw new ValidateException('虚拟商品只能虚拟发货');
|
||||
//订单记录
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
switch ($data['delivery_type']) {
|
||||
case 1:
|
||||
@ -1359,13 +1375,35 @@ class StoreOrderRepository extends BaseRepository
|
||||
event('order.delivery.before', compact('order', 'data'));
|
||||
$this->dao->update($id, $data);
|
||||
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => $change_message,
|
||||
'change_type' => $change_type,
|
||||
];
|
||||
if ($service_id) {
|
||||
$statusRepository->createServiceLog($service_id,$orderStatus);
|
||||
} else {
|
||||
$statusRepository->createAdminLog($orderStatus);
|
||||
}
|
||||
|
||||
|
||||
//虚拟发货后用户直接确认收获
|
||||
if($data['status'] == 2){
|
||||
$user = app()->make(UserRepository::class)->get($order['uid']);
|
||||
//订单记录
|
||||
$this->takeAfter($order,$user);
|
||||
}
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => '虚拟发货后',
|
||||
'change_type' => $statusRepository::ORDER_STATUS_TAKE,
|
||||
];
|
||||
$statusRepository->createSysLog($orderStatus);
|
||||
|
||||
$statusRepository->status($id, $change_type, $change_message);
|
||||
}
|
||||
if (isset($temp_code)) Queue::push(SendSmsJob::class, ['tempId' => $temp_code, 'id' => $order->order_id]);
|
||||
|
||||
event('order.delivery', compact('order', 'data'));
|
||||
@ -1380,18 +1418,29 @@ class StoreOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 2/16/22
|
||||
*/
|
||||
public function cityDelivery(int $id, int $merId, array $data)
|
||||
public function cityDelivery(int $id, int $merId, array $data, $service_id)
|
||||
{
|
||||
$make = app()->make(DeliveryOrderRepository::class);
|
||||
$order = $this->dao->get($id);
|
||||
if ($order['is_virtual'])
|
||||
throw new ValidateException('虚拟商品只能虚拟发货');
|
||||
$make->create($id, $merId, $data, $order);
|
||||
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$this->dao->update($id, ['delivery_type' => 5, 'status' => 1,'remark' => $data['remark']]);
|
||||
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::ORDER_DELIVERY_CITY, '订单已配送【同城配送】');
|
||||
$orderStatus = [
|
||||
'order_id' => $id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单配送【同城配送】',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_DELIVERY_SELF,
|
||||
];
|
||||
if ($service_id) {
|
||||
$storeOrderStatusRepository->createServiceLog($service_id,$orderStatus);
|
||||
} else {
|
||||
$storeOrderStatusRepository->createAdminLog($orderStatus);
|
||||
}
|
||||
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_DELIVER_SUCCESS', 'id' => $id]);
|
||||
}
|
||||
@ -1404,7 +1453,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$whre['mer_id'] = $merId;
|
||||
$whre['is_system_del'] = 0;
|
||||
}
|
||||
return $this->dao->getWhere($where, '*', [
|
||||
$res = $this->dao->getWhere($where, '*', [
|
||||
'orderProduct',
|
||||
'user' => function ($query) {
|
||||
$query->field('uid,real_name,nickname,is_svip,svip_endtime,phone');
|
||||
@ -1412,13 +1461,24 @@ class StoreOrderRepository extends BaseRepository
|
||||
'refundOrder' => function ($query) {
|
||||
$query->field('order_id,extension_one,extension_two,refund_price,integral')->where('status', 3);
|
||||
},
|
||||
'finalOrder',]
|
||||
)->append(['refund_extension_one', 'refund_extension_two']);
|
||||
'finalOrder',
|
||||
'TopSpread' => function ($query) {
|
||||
$query->field('uid,nickname,avatar');
|
||||
},
|
||||
'spread' => function ($query) {
|
||||
$query->field('uid,nickname,avatar');
|
||||
},
|
||||
]
|
||||
);
|
||||
if (!$res) throw new ValidateException('数据不存在');
|
||||
$res['integral'] = (int)$res['integral'];
|
||||
return $res->append(['refund_extension_one', 'refund_extension_two']);
|
||||
}
|
||||
|
||||
public function getOrderStatus($id, $page, $limit)
|
||||
public function getOrderStatus($where, $page, $limit)
|
||||
{
|
||||
return app()->make(StoreOrderStatusRepository::class)->search($id, $page, $limit);
|
||||
$where['type'] = StoreOrderStatusRepository::TYPE_ORDER;
|
||||
return app()->make(StoreOrderStatusRepository::class)->search($where, $page, $limit);
|
||||
}
|
||||
|
||||
public function remarkForm($id)
|
||||
@ -1428,7 +1488,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$form->setRule([
|
||||
Elm::text('remark', '备注', $data['remark'])->required(),
|
||||
]);
|
||||
return $form->setTitle('修改备注');
|
||||
return $form->setTitle('订单备注');
|
||||
}
|
||||
|
||||
public function adminMarkForm($id)
|
||||
@ -1438,7 +1498,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$form->setRule([
|
||||
Elm::text('admin_mark', '备注', $data['admin_mark'])->required(),
|
||||
]);
|
||||
return $form->setTitle('修改备注');
|
||||
return $form->setTitle('订单备注');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1464,6 +1524,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
$query->field('group_order_id,group_order_sn');
|
||||
},
|
||||
'finalOrder',
|
||||
'user' => function ($query) {
|
||||
$query->field('uid,nickname,avatar');
|
||||
},
|
||||
])->page($page, $limit)->select()->append(['refund_extension_one', 'refund_extension_two']);
|
||||
|
||||
return compact('count', 'list');
|
||||
@ -1574,6 +1637,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
'spread' => function ($query) {
|
||||
$query->field('uid,nickname,avatar');
|
||||
},
|
||||
'user' => function ($query) {
|
||||
$query->field('uid,nickname,avatar');
|
||||
},
|
||||
]);
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select()->append(['refund_extension_one', 'refund_extension_two']);
|
||||
@ -1750,6 +1816,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
$order->presell_price = $order->pay_price;
|
||||
}
|
||||
}
|
||||
$order->takeOrderCount = count($order['takeOrderList']);
|
||||
unset($order['takeOrderList']);
|
||||
}
|
||||
|
||||
return compact( 'count','list');
|
||||
@ -1910,15 +1978,30 @@ class StoreOrderRepository extends BaseRepository
|
||||
foreach ($data['data'] as $v) {
|
||||
$splitData[$v['id']] = $v['num'];
|
||||
}
|
||||
$spl = app()->make(StoreOrderSplitRepository::class)->splitOrder($order, $splitData);
|
||||
$spl = app()->make(StoreOrderSplitRepository::class)->splitOrder($order, $splitData, $serviceId, 1);
|
||||
if ($spl) $order = $spl;
|
||||
$order->status = 2;
|
||||
$order->verify_time = date('Y-m-d H:i:s');
|
||||
$order->verify_service_id = $serviceId;
|
||||
event('order.verify.before', compact('order'));
|
||||
Db::transaction(function () use ($order) {
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
Db::transaction(function () use ($order,$storeOrderStatusRepository,$serviceId) {
|
||||
$this->takeAfter($order, $order->user);
|
||||
$order->save();
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单已核销',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_TAKE,
|
||||
];
|
||||
if ($serviceId){
|
||||
$storeOrderStatusRepository->createServiceLog($serviceId,$orderStatus);
|
||||
} else {
|
||||
$storeOrderStatusRepository->createAdminLog($orderStatus);
|
||||
}
|
||||
|
||||
});
|
||||
event('order.verify', compact('order'));
|
||||
}
|
||||
@ -2083,8 +2166,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
public function orderRefundAllAfter($order)
|
||||
{
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$statusRepository->status($order['order_id'], $statusRepository::ORDER_STATUS_REFUND_ALL, '订单已全部退款');
|
||||
|
||||
if ($order->activity_type == 10) {
|
||||
app()->make(StoreDiscountRepository::class)->incStock($order->orderProduct[0]['activity_id']);
|
||||
}
|
||||
@ -2113,6 +2195,17 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
|
||||
}
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单已全部退款',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_REFUND_ALL,
|
||||
];
|
||||
$storeOrderStatusRepository->createSysLog($orderStatus);
|
||||
|
||||
event('order.refundAll', compact('order'));
|
||||
}
|
||||
|
||||
@ -2137,12 +2230,20 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
public function delOrder($order, $info = '订单删除')
|
||||
{
|
||||
Db::transaction(function () use ($info, $order) {
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => $info,
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_DELETE,
|
||||
];
|
||||
$productRepository = app()->make(ProductRepository::class);
|
||||
Db::transaction(function () use ($info, $order, $orderStatus, $storeOrderStatusRepository,$productRepository) {
|
||||
$order->is_del = 1;
|
||||
$order->save();
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$statusRepository->status($order->order_id, $statusRepository::ORDER_STATUS_DELETE, $info);
|
||||
$productRepository = app()->make(ProductRepository::class);
|
||||
$storeOrderStatusRepository->createUserLog($orderStatus);
|
||||
foreach ($order->orderProduct as $cart) {
|
||||
$productRepository->orderProductIncStock($order, $cart);
|
||||
}
|
||||
@ -2314,7 +2415,28 @@ class StoreOrderRepository extends BaseRepository
|
||||
});
|
||||
if (file_exists($arrary['path'])) unlink($arrary['path']);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 根据订单查询相关联的自订单
|
||||
* @param $id
|
||||
* @param $merId
|
||||
* @return \think\Collection
|
||||
* @author Qinii
|
||||
* @day 2023/2/22
|
||||
*/
|
||||
public function childrenList($id,$merId)
|
||||
{
|
||||
$data = $this->dao->get($id);
|
||||
$query = $this->dao->getSearch([])->with(['orderProduct'])->where('order_id','<>',$id);
|
||||
if ($merId) $query->where('mer_id',$merId);
|
||||
if ($data['main_id']) {
|
||||
$query->where(function($query) use($data,$id){
|
||||
$query->where('main_id',$data['main_id'])->whereOr('order_id',$data['main_id']);
|
||||
});
|
||||
} else {
|
||||
$query->where('main_id',$id);
|
||||
}
|
||||
return $query->select();
|
||||
}
|
||||
public function setProduct(array $arrary, $merId)
|
||||
{
|
||||
//读取excel
|
||||
|
@ -26,22 +26,22 @@ use think\facade\Db;
|
||||
*/
|
||||
class StoreOrderSplitRepository extends StoreOrderRepository
|
||||
{
|
||||
public function splitOrder(StoreOrder $order, array $rule)
|
||||
public function splitOrder(StoreOrder $order, array $rule, $service_id = 0, $type = null)
|
||||
{
|
||||
return app()->make(LockService::class)->exec('order.split.' . $order->order_id, function () use ($rule, $order) {
|
||||
return $this->execSplitOrder($order, $rule);
|
||||
return app()->make(LockService::class)->exec('order.split.' . $order->order_id, function () use ($rule, $order,$service_id,$type) {
|
||||
return $this->execSplitOrder($order, $rule, $service_id,$type);
|
||||
});
|
||||
}
|
||||
|
||||
public function execSplitOrder(StoreOrder $order, array $rule)
|
||||
public function execSplitOrder(StoreOrder $order, array $rule, $service_id = 0, $type = null)
|
||||
{
|
||||
if ($order['status'] != 0) {
|
||||
throw new ValidateException('订单已发货');
|
||||
}
|
||||
if ($order['activity_type'] == 2) {
|
||||
if ($order['activity_type'] == 2 && !$type) {
|
||||
throw new ValidateException('预售订单不能拆单');
|
||||
}
|
||||
return Db::transaction(function () use ($order, $rule) {
|
||||
return Db::transaction(function () use ($order, $rule,$service_id) {
|
||||
$newOrderId = 0;
|
||||
$newOrder = $order->getOrigin();
|
||||
$newOrder['total_num'] = 0;
|
||||
@ -199,6 +199,29 @@ class StoreOrderSplitRepository extends StoreOrderRepository
|
||||
if ($flag) {
|
||||
$this->orderRefundAllAfter($order);
|
||||
}
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => '生成子订单:'.$newOrder->order_sn,
|
||||
'change_type' => $statusRepository::ORDER_STATUS_SPLIT,
|
||||
];
|
||||
$newOrderStatus = [
|
||||
'order_id' => $newOrder->order_id,
|
||||
'order_sn' => $newOrder->order_sn,
|
||||
'type' => $statusRepository::TYPE_ORDER,
|
||||
'change_message' => '生成子订单',
|
||||
'change_type' => $statusRepository::ORDER_STATUS_SPLIT,
|
||||
];
|
||||
|
||||
if ($service_id) {
|
||||
$statusRepository->createServiceLog($service_id,$orderStatus);
|
||||
$statusRepository->createServiceLog($service_id,$newOrderStatus);
|
||||
} else {
|
||||
$statusRepository->createAdminLog($orderStatus);
|
||||
$statusRepository->createAdminLog($newOrderStatus);
|
||||
}
|
||||
return $newOrder;
|
||||
});
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
|
||||
use app\common\dao\store\order\StoreOrderStatusDao;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\service\StoreServiceRepository;
|
||||
use app\common\repositories\store\service\StoreServiceUserRepository;
|
||||
|
||||
/**
|
||||
* Class StoreOrderStatusRepository
|
||||
@ -26,21 +27,57 @@ use app\common\repositories\BaseRepository;
|
||||
*/
|
||||
class StoreOrderStatusRepository extends BaseRepository
|
||||
{
|
||||
//订单日志
|
||||
public const TYPE_ORDER = 'order';
|
||||
//退款单日志
|
||||
public const TYPE_REFUND = 'refund';
|
||||
//商品日志
|
||||
// public const TYPE_PRODUCT = 'product';
|
||||
|
||||
//操作者类型
|
||||
public const U_TYPE_SYSTEM = 0;
|
||||
public const U_TYPE_USER = 1;
|
||||
public const U_TYPE_ADMIN = 2;
|
||||
public const U_TYPE_MERCHANT = 3;
|
||||
public const U_TYPE_SERVICE = 4;
|
||||
|
||||
|
||||
//订单变动类型
|
||||
//取消
|
||||
const ORDER_STATUS_CANCEL = 'cancel';
|
||||
//改价
|
||||
const ORDER_STATUS_CHANGE = 'change';
|
||||
//创建
|
||||
const ORDER_STATUS_CREATE = 'create';
|
||||
//删除
|
||||
const ORDER_STATUS_DELETE = 'delete';
|
||||
//收货
|
||||
const ORDER_STATUS_TAKE = 'take';
|
||||
//拆单
|
||||
const ORDER_STATUS_SPLIT = 'split';
|
||||
//完成
|
||||
const ORDER_STATUS_OVER = 'over';
|
||||
const ORDER_STATUS_PRESELL= 'presell';
|
||||
const ORDER_STATUS_REFUND_ALL = 'refund_all';
|
||||
const ORDER_STATUS_AUTO_OVER = 'auto_over';
|
||||
//预售订单
|
||||
const ORDER_STATUS_PRESELL= 'presell';
|
||||
const ORDER_STATUS_PRESELL_CLOSE = 'presell_close';
|
||||
const ORDER_STATUS_PAY_SUCCCESS = 'pay_success';
|
||||
//全部退款
|
||||
const ORDER_STATUS_REFUND_ALL = 'refund_all';
|
||||
//支付成功
|
||||
const ORDER_STATUS_PAY_SUCCCESS = 'pay_success';
|
||||
//拼图成功
|
||||
const ORDER_STATUS_GROUP_SUCCESS = 'group_success';
|
||||
//申请退款
|
||||
const CHANGE_REFUND_CREATGE = 'refund_create';
|
||||
//已发货
|
||||
const CHANGE_BACK_GOODS = 'back_goods';
|
||||
//退款申请已通过
|
||||
const CHANGE_REFUND_AGREE = 'refund_agree';
|
||||
//退款成功
|
||||
const CHANGE_REFUND_PRICE = 'refund_price';
|
||||
//订单退款已拒绝
|
||||
const CHANGE_REFUND_REFUSE = 'refund_refuse';
|
||||
//用户取消退款
|
||||
const CHANGE_REFUND_CANCEL = 'refund_cancel';
|
||||
|
||||
/*
|
||||
2 => '待取货',
|
||||
@ -64,7 +101,6 @@ class StoreOrderStatusRepository extends BaseRepository
|
||||
const ORDER_DELIVERY_CITY_REFUNDING = 'delivery_5_9';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* StoreOrderStatusRepository constructor.
|
||||
* @param StoreOrderStatusDao $dao
|
||||
@ -87,11 +123,52 @@ class StoreOrderStatusRepository extends BaseRepository
|
||||
return $this->dao->create(compact('order_id', 'change_message', 'change_type'));
|
||||
}
|
||||
|
||||
public function search($id,$page, $limit)
|
||||
public function search($where,$page, $limit)
|
||||
{
|
||||
$query = $this->dao->search($id);
|
||||
$query = $this->dao->search($where)->order('change_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
return compact('count','list');
|
||||
}
|
||||
|
||||
public function createAdminLog(array $data)
|
||||
{
|
||||
$request = request();
|
||||
$data['user_type'] = $request->userType();
|
||||
$data['uid'] = $request->adminId();
|
||||
$data['nickname'] = $request->adminInfo()->real_name;
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function createServiceLog($service_id, array $data)
|
||||
{
|
||||
$service = app()->make(StoreServiceRepository::class)->getWhere(['service_id' => $service_id]);
|
||||
$data['user_type'] = self::U_TYPE_SERVICE;
|
||||
$data['uid'] = $service_id;
|
||||
$data['nickname'] = $service->nickname;
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function createUserLog(array $data)
|
||||
{
|
||||
$data['user_type'] = self::U_TYPE_USER;
|
||||
$data['uid'] = request()->uid();
|
||||
$data['nickname'] = request()->userInfo()->nickname;
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function createSysLog(array $data)
|
||||
{
|
||||
$data['user_type'] = self::U_TYPE_SYSTEM;
|
||||
$data['uid'] = 0;
|
||||
$data['nickname'] = '系统';
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function batchCreateLog($data)
|
||||
{
|
||||
if(!empty($data)) {
|
||||
return $this->dao->insertAll($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,10 +118,19 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
*/
|
||||
public function userDel($id, $uid)
|
||||
{
|
||||
Db::transaction(function () use ($uid, $id) {
|
||||
$ret = $this->dao->get($id);
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $ret->refund_order_id,
|
||||
'order_sn' => $ret->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => '创建退款单',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_DELETE,
|
||||
];
|
||||
Db::transaction(function () use ($uid, $id,$storeOrderStatusRepository,$orderStatus) {
|
||||
$this->dao->userDel($uid, $id);
|
||||
$make = app()->make(StoreRefundStatusRepository::class);
|
||||
$make->status($id, $make::CHANGE_DELETE, '删除记录');
|
||||
$storeOrderStatusRepository->createUserLog($orderStatus);
|
||||
});
|
||||
}
|
||||
|
||||
@ -182,7 +191,7 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$data['order_id'] = $products[0]['order_id'];
|
||||
$data['uid'] = $products[0]['uid'];
|
||||
$data['mer_id'] = $order['mer_id'];
|
||||
$data['refund_order_sn'] = $this->getNewOrderId();
|
||||
$data['refund_order_sn'] = app()->make(StoreOrderRepository::class)->getNewOrderId(StoreOrderRepository::TYPE_SN_REFUND);
|
||||
$data['refund_num'] = $totalRefundNum;
|
||||
$data['extension_one'] = $total_extension_one;
|
||||
$data['extension_two'] = $total_extension_two;
|
||||
@ -190,7 +199,10 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$data['integral'] = $totalIntegral;
|
||||
$data['platform_refund_price'] = $totalPlatformRefundPrice;
|
||||
$data['refund_postage'] = $totalPostage;
|
||||
return Db::transaction(function () use ($refundProduct, $data, $products, $order, &$refund_order_id) {
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
|
||||
return Db::transaction(function () use ($refundProduct, $data, $products, $order, &$refund_order_id,$storeOrderStatusRepository,$refund_message) {
|
||||
event('refund.creates.before', compact('data'));
|
||||
$refund = $this->dao->create($data);
|
||||
$refund_order_id = $refund->refund_order_id;
|
||||
@ -199,8 +211,14 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$product->is_refund = 1;
|
||||
$product->save();
|
||||
}
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($refund->refund_order_id, $statusRepository::CHANGE_CREATE, '创建批量退款单');
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $order->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => $refund_message,
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_CREATE,
|
||||
];
|
||||
$storeOrderStatusRepository->createSysLog($orderStatus);
|
||||
app()->make(StoreRefundProductRepository::class)->insertAll($refundProduct);
|
||||
return $refund;
|
||||
});
|
||||
@ -304,7 +322,7 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$data['order_id'] = $products[0]['order_id'];
|
||||
$data['uid'] = $products[0]['uid'];
|
||||
$data['mer_id'] = $order['mer_id'];
|
||||
$data['refund_order_sn'] = $this->getNewOrderId();
|
||||
$data['refund_order_sn'] = app()->make(StoreOrderRepository::class)->getNewOrderId(StoreOrderRepository::TYPE_SN_REFUND);
|
||||
$data['refund_num'] = $totalRefundNum;
|
||||
$data['extension_one'] = $total_extension_one;
|
||||
$data['extension_two'] = $total_extension_two;
|
||||
@ -312,6 +330,7 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$data['integral'] = $totalIntegral;
|
||||
$data['platform_refund_price'] = $totalPlatformRefundPrice;
|
||||
$data['refund_postage'] = $totalPostage;
|
||||
|
||||
return Db::transaction(function () use ($refundProduct, $data, $products, $order, &$refund_order_id) {
|
||||
event('refund.creates.before', compact('data'));
|
||||
$refund = $this->dao->create($data);
|
||||
@ -321,8 +340,6 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$product->is_refund = 1;
|
||||
$product->save();
|
||||
}
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($refund->refund_order_id, $statusRepository::CHANGE_CREATE, '创建批量退款单');
|
||||
app()->make(StoreRefundProductRepository::class)->insertAll($refundProduct);
|
||||
$this->applyRefundAfter($refund, $order);
|
||||
return $refund;
|
||||
@ -332,6 +349,24 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
public function applyRefundAfter($refund, $order)
|
||||
{
|
||||
event('refund.create', compact('refund', 'order'));
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $refund->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => '创建退款单',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_CREATE,
|
||||
];
|
||||
$storeOrderStatusRepository->createUserLog($orderStatus);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '申请退款',
|
||||
'change_type' => $storeOrderStatusRepository::CHANGE_REFUND_CREATGE,
|
||||
];
|
||||
$storeOrderStatusRepository->createUserLog($orderStatus);
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'ADMIN_RETURN_GOODS_CODE', 'id' => $refund->refund_order_id]);
|
||||
SwooleTaskService::merchant('notice', [
|
||||
'type' => 'new_refund_order',
|
||||
@ -424,10 +459,11 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
|
||||
$data['uid'] = $product['uid'];
|
||||
$data['mer_id'] = $order['mer_id'];
|
||||
$data['refund_order_sn'] = $this->getNewOrderId();
|
||||
$data['refund_order_sn'] = app()->make(StoreOrderRepository::class)->getNewOrderId(StoreOrderRepository::TYPE_SN_REFUND);
|
||||
$data['refund_num'] = $num;
|
||||
$data['extension_one'] = $total_extension_one;
|
||||
$data['extension_two'] = $total_extension_two;
|
||||
|
||||
return Db::transaction(function () use ($order, $data, $product, $productId, $num) {
|
||||
event('refund.create.before', compact('data'));
|
||||
$refund = $this->dao->create($data);
|
||||
@ -443,26 +479,12 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$product->refund_num -= $num;
|
||||
$product->is_refund = 1;
|
||||
$product->save();
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($refund->refund_order_id, $statusRepository::CHANGE_CREATE, '创建退款单');
|
||||
$this->applyRefundAfter($refund, $order);
|
||||
return $refund;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author xaboy
|
||||
* @day 2020/6/9
|
||||
*/
|
||||
public function getNewOrderId()
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = 'rwx' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
@ -680,10 +702,19 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
throw new ValidateException('退款单状态有误');
|
||||
$refund->status = 2;
|
||||
$refund->status_time = date('Y-m-d H:i:s');
|
||||
Db::transaction(function () use ($refund, $data, $id, $uid) {
|
||||
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $refund->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => '退款单退回商品已发货',
|
||||
'change_type' => $storeOrderStatusRepository::CHANGE_BACK_GOODS,
|
||||
];
|
||||
Db::transaction(function () use ($refund, $data, $id, $uid,$storeOrderStatusRepository,$orderStatus) {
|
||||
$refund->save($data);
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::CHANGE_BACK_GOODS, '已发货');
|
||||
$storeOrderStatusRepository->createUserLog($orderStatus);
|
||||
event('refund.backGoods',compact('uid','id','data'));
|
||||
});
|
||||
Queue::push(SendSmsJob::class, [
|
||||
@ -754,17 +785,41 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 2020-06-13
|
||||
*/
|
||||
public function refuse($id, $data)
|
||||
public function refuse($id, $data, $service_id = 0)
|
||||
{
|
||||
Db::transaction(function () use ($id, $data) {
|
||||
$res = $this->getWhere(['refund_order_id' => $id], '*', ['refundProduct.product']);
|
||||
$refund = $this->getWhere(['refund_order_id' => $id], '*', ['refundProduct.product']);
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->order_id,
|
||||
'order_sn' => $refund->order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单退款已拒绝:'.$refund->refund_order_sn,
|
||||
'change_type' => $storeOrderStatusRepository::CHANGE_REFUND_REFUSE,
|
||||
];
|
||||
$refundOrderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $refund->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => '订单退款已拒绝',
|
||||
'change_type' => $storeOrderStatusRepository::CHANGE_REFUND_REFUSE,
|
||||
];
|
||||
|
||||
Db::transaction(function () use ($id, $data,$refund,$service_id,$storeOrderStatusRepository,$orderStatus,$refundOrderStatus) {
|
||||
|
||||
$data['status_time'] = date('Y-m-d H:i:s');
|
||||
$this->getProductRefundNumber($res, -1);
|
||||
$this->getProductRefundNumber($refund, -1);
|
||||
$this->dao->update($id, $data);
|
||||
$refund = $res;
|
||||
|
||||
if ($service_id) {
|
||||
$storeOrderStatusRepository->createServiceLog($service_id,$orderStatus);
|
||||
$storeOrderStatusRepository->createServiceLog($service_id,$refundOrderStatus);
|
||||
} else {
|
||||
$storeOrderStatusRepository->createAdminLog($orderStatus);
|
||||
$storeOrderStatusRepository->createAdminLog($refundOrderStatus);
|
||||
}
|
||||
|
||||
event('refund.refuse',compact('id','refund'));
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::CHANGE_REFUND_REFUSE, '订单退款已拒绝');
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'REFUND_FAIL_CODE', 'id' => $id]);
|
||||
});
|
||||
}
|
||||
@ -778,31 +833,43 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 2020-06-13
|
||||
*/
|
||||
public function agree(int $id, array $data, int $adminId)
|
||||
public function agree(int $id, array $data, $service_id = 0)
|
||||
{
|
||||
|
||||
//已退款金额
|
||||
$_refund_price = $this->checkRefundPrice($id);
|
||||
|
||||
Db::transaction(function () use ($id, $data, $adminId, $_refund_price) {
|
||||
$res = $this->dao->getWhere(['refund_order_id' => $id], '*', ['refundProduct.product']);
|
||||
$this->getProductRefundNumber($res, 1);
|
||||
$refund = $res;
|
||||
if ($res['refund_type'] == 1) {
|
||||
$refund = $this->dao->getWhere(['refund_order_id' => $id], '*', ['refundProduct.product']);
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $refund->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
];
|
||||
Db::transaction(function () use ($id, $data, $_refund_price, $refund,$storeOrderStatusRepository,$orderStatus,$service_id) {
|
||||
$this->getProductRefundNumber($refund, 1);
|
||||
if ($refund['refund_type'] == 1) {
|
||||
//TODO 退款单同意退款
|
||||
$refund = $this->doRefundPrice($id, $_refund_price);
|
||||
$data['status'] = 3;
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::CHANGE_REFUND_PRICE, '退款成功');
|
||||
$orderStatus['change_message'] = '退款成功';
|
||||
$orderStatus['change_type'] = $storeOrderStatusRepository::ORDER_STATUS_CREATE;
|
||||
$this->refundAfter($refund);
|
||||
}
|
||||
if ($res['refund_type'] == 2) {
|
||||
if ($refund['refund_type'] == 2) {
|
||||
$data['status'] = 1;
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::CHANGE_REFUND_AGREE, '退款申请已通过,请将商品寄回');
|
||||
$orderStatus['change_message'] = '退款申请已通过,请将商品寄回';
|
||||
$orderStatus['change_type'] = $storeOrderStatusRepository::CHANGE_REFUND_AGREE;
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'REFUND_SUCCESS_CODE', 'id' => $id]);
|
||||
}
|
||||
$data['status_time'] = date('Y-m-d H:i:s');
|
||||
$this->dao->update($id, $data);
|
||||
if ($service_id) {
|
||||
$storeOrderStatusRepository->createServiceLog($service_id,$orderStatus);
|
||||
} else {
|
||||
$storeOrderStatusRepository->createAdminLog($orderStatus);
|
||||
}
|
||||
event('refund.agree', compact('id', 'refund'));
|
||||
});
|
||||
}
|
||||
@ -870,6 +937,7 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
'type' => 1,
|
||||
'order_id' => $orderId,
|
||||
];
|
||||
|
||||
return $this->dao->search($where)->when($refundOrderId, function ($query) use ($refundOrderId) {
|
||||
$query->where('refund_order_id', '<>', $refundOrderId);
|
||||
})->column('refund_order_id');
|
||||
@ -1079,16 +1147,28 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 2020-06-13
|
||||
*/
|
||||
public function adminRefund($id, $admin)
|
||||
public function adminRefund($id, $service_id = null)
|
||||
{
|
||||
Db::transaction(function () use ($admin, $id) {
|
||||
$refund = $this->dao->getWhere(['refund_order_id' => $id], '*', ['refundProduct.product']);
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $refund->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => '退款成功',
|
||||
'change_type' => $storeOrderStatusRepository::CHANGE_REFUND_PRICE,
|
||||
];
|
||||
Db::transaction(function () use ($service_id, $id,$refund,$storeOrderStatusRepository,$orderStatus) {
|
||||
$data['status'] = 3;
|
||||
$data['status_time'] = date('Y-m-d H:i:s');
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::CHANGE_REFUND_PRICE, '退款成功' . ($admin ? '' : '[自动]'));
|
||||
$this->dao->update($id, $data);
|
||||
$res = $this->dao->getWhere(['refund_order_id' => $id], '*', ['refundProduct.product']);
|
||||
$this->getProductRefundNumber($res, 1, true);
|
||||
if ($service_id) {
|
||||
$storeOrderStatusRepository->createServiceLog($service_id,$orderStatus);
|
||||
} else {
|
||||
$storeOrderStatusRepository->createAdminLog($orderStatus);
|
||||
}
|
||||
$this->getProductRefundNumber($refund, 1, true);
|
||||
$refund = $this->doRefundPrice($id, 0);
|
||||
if ($refund) $this->refundAfter($refund);
|
||||
});
|
||||
@ -1134,7 +1214,10 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
'data' => [
|
||||
'refund_id' => $res->refund_order_sn,
|
||||
'pay_price' => $res->order->groupOrder->pay_price,
|
||||
'refund_price' => $res->refund_price
|
||||
'refund_price' => $res->refund_price,
|
||||
'refund_message' => $res->refund_message,
|
||||
'open_id' => $res->user->wechat->routine_openid ?? null,
|
||||
'transaction_id' => $res->order->transaction_id,
|
||||
]
|
||||
];
|
||||
}
|
||||
@ -1469,15 +1552,25 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
public function cancel(int $id, $user)
|
||||
{
|
||||
//状态 0:待审核 -1:审核未通过 1:待退货 2:待收货 3:已退款
|
||||
$res = $this->dao->getWhere(['refund_order_id' => $id, 'uid' => $user->uid],'*', ['refundProduct.product']);
|
||||
if (!$res) throw new ValidateException('数据不存在');
|
||||
if (!in_array($res['status'],[self::REFUND_STATUS_WAIT, self::REFUND_STATUS_BACK]))
|
||||
$refund = $this->dao->getWhere(['refund_order_id' => $id, 'uid' => $user->uid],'*', ['refundProduct.product']);
|
||||
if (!$refund) throw new ValidateException('数据不存在');
|
||||
if (!in_array($refund['status'],[self::REFUND_STATUS_WAIT, self::REFUND_STATUS_BACK]))
|
||||
throw new ValidateException('当前状态不可取消');
|
||||
Db::transaction(function () use ($id, $res) {
|
||||
$this->getProductRefundNumber($res, -1);
|
||||
|
||||
//退款订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $refund->refund_order_id,
|
||||
'order_sn' => $refund->refund_order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_REFUND,
|
||||
'change_message' => '用户取消退款',
|
||||
'change_type' => $storeOrderStatusRepository::CHANGE_REFUND_CANCEL,
|
||||
];
|
||||
|
||||
Db::transaction(function () use ($id, $refund,$storeOrderStatusRepository,$orderStatus) {
|
||||
$this->getProductRefundNumber($refund, -1);
|
||||
$this->dao->update($id, ['status_time' => date('Y-m-d H:i:s'), 'status' => self::REFUND_STATUS_CANCEL]);
|
||||
$statusRepository = app()->make(StoreRefundStatusRepository::class);
|
||||
$statusRepository->status($id, $statusRepository::CHANGE_REFUND_CANCEL, '用户取消退款');
|
||||
$storeOrderStatusRepository->createUserLog($orderStatus);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ class ProductAssistRepository extends BaseRepository
|
||||
'data' => [
|
||||
'title' => $data['status'] == -2 ? '下架提醒' : '审核结果',
|
||||
'message' => $message,
|
||||
'id' => $id[0]
|
||||
'id' => $id
|
||||
]
|
||||
], $ret->mer_id);
|
||||
app()->make(SpuRepository::class)->changeStatus($id,3);
|
||||
|
@ -44,23 +44,24 @@ class ProductCopyRepository extends BaseRepository
|
||||
public function getProduct($url,$merId)
|
||||
{
|
||||
$key = $merId.'_url_'.$url;
|
||||
|
||||
if ($result= Cache::get($key)) return $result;
|
||||
if (systemConfig('copy_product_status') == 2) {
|
||||
$resultData['data'] = app()->make(CrmebServeServices::class)->copy()->goods($url);
|
||||
$resultData['status'] = 200;
|
||||
} else {
|
||||
if (systemConfig('copy_product_status') == 1) {
|
||||
$resultData = $this->useApi($url);
|
||||
} else {
|
||||
$resultData['data'] = app()->make(CrmebServeServices::class)->copy()->goods($url);
|
||||
$resultData['status'] = true;
|
||||
}
|
||||
if ($resultData['status']) {
|
||||
if ($resultData['status'] && $resultData['status']) {
|
||||
$result = $this->getParamsData($resultData['data']);
|
||||
|
||||
Cache::set($key,$result);
|
||||
$this->add(['type' => 'copy', 'num' => 1, 'info' => $url , 'mer_id'=> $merId, 'message' => '采集商品',],$merId);
|
||||
$this->add(['type' => 'copy', 'num' => -1, 'info' => $url , 'mer_id' => $merId, 'message' => '采集商品',],$merId);
|
||||
return $result;
|
||||
} else {
|
||||
if (isset($resultData['msg']))
|
||||
throw new ValidateException('接口错误信息:'.$resultData['msg']);
|
||||
throw new ValidateException('采集失败,请更换链接重试!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,7 +218,8 @@ class ProductCopyRepository extends BaseRepository
|
||||
]);
|
||||
$make = app()->make(AttachmentRepository::class);
|
||||
$serve = app()->make(DownloadImageService::class);
|
||||
$type = systemConfig('upload_type');
|
||||
$type = (int)systemConfig('upload_type') ?: 1;
|
||||
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $datum) {
|
||||
$arcurl = is_int(strpos($datum, 'http')) ? $datum : 'http://' . ltrim( $datum, '\//');
|
||||
@ -310,7 +312,7 @@ class ProductCopyRepository extends BaseRepository
|
||||
if(systemConfig('copy_product_status')){
|
||||
$data = [
|
||||
'type' => 'sys',
|
||||
'num' => systemConfig('copy_product_defaul'),
|
||||
'num' => systemConfig('copy_product_defaul') ?? 0,
|
||||
'message' => '赠送次数',
|
||||
];
|
||||
$this->add($data,$merId);
|
||||
|
@ -10,10 +10,12 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\repositories\store\product;
|
||||
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\store\product\ProductGroupBuying;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\dao\store\product\ProductGroupBuyingDao;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOrderStatusRepository;
|
||||
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
use crmeb\jobs\CancelGroupBuyingJob;
|
||||
@ -191,9 +193,33 @@ class ProductGroupBuyingRepository extends BaseRepository
|
||||
app()->make(ProductGroupRepository::class)->incField($res['product_group_id'], 'success_num', 1);
|
||||
$productGroupUserRepository = app()->make(ProductGroupUserRepository::class);
|
||||
$productGroupUserRepository->updateStatus($res['group_buying_id']);
|
||||
$orderIds = $productGroupUserRepository->groupOrderIds($res['group_buying_id']);
|
||||
app()->make(StoreOrderRepository::class)->groupBuyingStatus($orderIds, 0);
|
||||
Queue::push(SendSmsJob::class,['tempId' => 'USER_BALANCE_CHANGE', 'id' => $res->group_buying_id]);
|
||||
$user = $productGroupUserRepository->groupOrderIds($res['group_buying_id']);
|
||||
$storeOrderStatusRepository = app()->make(storeOrderStatusRepository::class);
|
||||
$data = $orderIds = [];
|
||||
foreach ($user as $item) {
|
||||
$data[] = [
|
||||
'order_id' => $item['order_id'],
|
||||
'order_sn' => $item['orderInfo']['order_sn'],
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '拼团成功',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_GROUP_SUCCESS,
|
||||
'uid' => 0,
|
||||
'nickname' => '系统',
|
||||
'user_type' => $storeOrderStatusRepository::U_TYPE_SYSTEM,
|
||||
];
|
||||
$orderIds[] = $item['order_id'];
|
||||
}
|
||||
if ($data && $orderIds) {
|
||||
Db::transaction(function () use ($storeOrderStatusRepository, $orderIds, $data, $res) {
|
||||
$storeOrderStatusRepository->batchCreateLog($data);
|
||||
app()->make(StoreOrderRepository::class)
|
||||
->getSearch([])
|
||||
->whereIn('order_id', $orderIds)
|
||||
->update(['status' => 0]);
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'USER_BALANCE_CHANGE', 'id' => $res->group_buying_id]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -488,7 +488,7 @@ class ProductGroupRepository extends BaseRepository
|
||||
'data' => [
|
||||
'title' => $data['status'] == -2 ? '下架提醒' : '审核结果',
|
||||
'message' => $message,
|
||||
'id' => $id[0]
|
||||
'id' => $id
|
||||
]
|
||||
], $ret->mer_id);
|
||||
app()->make(SpuRepository::class)->changeStatus($id,4);
|
||||
|
@ -17,6 +17,7 @@ use app\common\model\store\product\ProductLabel;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\order\StoreOrderProductRepository;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use crmeb\jobs\ChangeSpuStatusJob;
|
||||
use crmeb\services\SwooleTaskService;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
@ -503,7 +504,6 @@ class ProductPresellRepository extends BaseRepository
|
||||
$item->product->product_type = 0;
|
||||
$item->product->save();
|
||||
queue(ChangeSpuStatusJob::class, ['id' => $item->product_presell_id, 'product_type' => 2]);
|
||||
// app()->make(SpuRepository::class)->changeStatus($item->product_presell_id, 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -526,6 +526,7 @@ class ProductPresellRepository extends BaseRepository
|
||||
if (!$ret)
|
||||
throw new ValidateException('数据不存在');
|
||||
event('product.presellStatus.before', compact('id', 'data'));
|
||||
|
||||
$this->dao->update($id, $data);
|
||||
event('product.presellStatus', compact('id', 'data'));
|
||||
|
||||
@ -536,9 +537,10 @@ class ProductPresellRepository extends BaseRepository
|
||||
'data' => [
|
||||
'title' => $data['status'] == -2 ? '下架提醒' : '审核结果',
|
||||
'message' => $message,
|
||||
'id' => $id[0]
|
||||
'id' => $id
|
||||
]
|
||||
], $ret->mer_id);
|
||||
|
||||
app()->make(SpuRepository::class)->changeStatus($id,2);
|
||||
}
|
||||
}
|
||||
|
@ -249,8 +249,16 @@ class ProductReplyRepository extends BaseRepository
|
||||
$orderProduct->orderInfo->status = 3;
|
||||
$orderProduct->orderInfo->save();
|
||||
//TODO 交易完成
|
||||
$statusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$statusRepository->status($orderProduct->orderInfo->order_id, $statusRepository::ORDER_STATUS_OVER, '交易完成');
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $orderProduct->orderInfo->order_id,
|
||||
'order_sn' => $orderProduct->orderInfo->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '交易完成',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_OVER,
|
||||
];
|
||||
$storeOrderStatusRepository->createSysLog($orderStatus);
|
||||
}
|
||||
});
|
||||
SwooleTaskService::merchant('notice', [
|
||||
|
@ -73,8 +73,8 @@ class ProductRepository extends BaseRepository
|
||||
['svip_price_type',0],
|
||||
['params',[]],
|
||||
];
|
||||
protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id';
|
||||
protected $filed = 'Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id';
|
||||
protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id,mer_svip_status,svip_price,svip_price_type';
|
||||
protected $filed = 'Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id,mer_svip_status,svip_price,svip_price_type';
|
||||
|
||||
const NOTIC_MSG = [
|
||||
1 => [
|
||||
@ -553,6 +553,7 @@ class ProductRepository extends BaseRepository
|
||||
$price = $stock = $ot_price = $cost = $svip_price = 0;
|
||||
try {
|
||||
foreach ($data['attrValue'] as $value) {
|
||||
$_svip_price = 0;
|
||||
$sku = '';
|
||||
if (isset($value['detail']) && !empty($value['detail']) && is_array($value['detail'])) {
|
||||
$sku = implode(',', $value['detail']);
|
||||
@ -568,9 +569,11 @@ class ProductRepository extends BaseRepository
|
||||
$ot_price_ = $value['ot_price'];
|
||||
$sprice = ($value['price'] < 0) ? 0 : $value['price'];
|
||||
}
|
||||
if (isset($value['svip_price']) && $data['svip_price_type']) {
|
||||
if ($data['svip_price_type'] == 2) {
|
||||
$_svip_price = $value['svip_price'];
|
||||
$svip_price = !$svip_price ? $value['svip_price'] : (($svip_price > $value['svip_price']) ? $value['svip_price'] : $svip_price);
|
||||
}
|
||||
|
||||
$cost = !$cost ? $value['cost'] : (($cost > $value['cost']) ?$cost: $value['cost']);
|
||||
$price = !$price ? $sprice : (($price > $sprice) ? $sprice : $price);
|
||||
$ot_price = !$ot_price ? $ot_price_ : (($ot_price > $ot_price_) ? $ot_price : $ot_price_);
|
||||
@ -593,7 +596,7 @@ class ProductRepository extends BaseRepository
|
||||
"sku" => $sku,
|
||||
"unique" => $unique,
|
||||
'sales' => $isUpdate ? ($oldSku[$sku]['sales'] ?? 0) : 0,
|
||||
'svip_price' => $svip_price,
|
||||
'svip_price' => $_svip_price,
|
||||
'mer_id' => $merId,
|
||||
];
|
||||
$stock = $stock + intval($value['stock']);
|
||||
@ -1351,6 +1354,8 @@ class ProductRepository extends BaseRepository
|
||||
'check' => false
|
||||
];
|
||||
}
|
||||
$attr[$key]['product_id'] = $item['product_id'];
|
||||
$attr[$key]['attr_name'] = $item['attr_name'];
|
||||
$attr[$key]['attr_value'] = $arr;
|
||||
$attr[$key]['attr_values'] = $values;
|
||||
}
|
||||
@ -1551,7 +1556,7 @@ class ProductRepository extends BaseRepository
|
||||
if ($status == 1 && $product['product_type'] == 3)
|
||||
throw new ValidateException('商品正在参与助力活动');
|
||||
$this->dao->update($id,[$field => $status]);
|
||||
app()->make(SpuRepository::class)->changeStatus($id,0);
|
||||
app()->make(SpuRepository::class)->changeStatus($id,$product->product_type);
|
||||
}
|
||||
|
||||
public function batchSwitchShow($id, $status, $field, $merId = 0)
|
||||
@ -1562,6 +1567,7 @@ class ProductRepository extends BaseRepository
|
||||
if (!$products)
|
||||
throw new ValidateException('数据不存在');
|
||||
foreach ($products as $product) {
|
||||
$product_type = $product['product_type'];
|
||||
if ($merId && $product['mer_id'] !== $merId)
|
||||
throw new ValidateException('商品不属于您');
|
||||
if ($status == 1 && $product['product_type'] == 2)
|
||||
@ -1570,7 +1576,7 @@ class ProductRepository extends BaseRepository
|
||||
throw new ValidateException('ID:'.$product->product_id . ' 商品正在参与助力活动');
|
||||
}
|
||||
$this->dao->updates($id,[$field => $status]);
|
||||
Queue::push(ChangeSpuStatusJob::class,['id' => $id,'product_type'=>0]);
|
||||
Queue::push(ChangeSpuStatusJob::class,['id' => $id,'product_type'=> $product_type]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1585,7 +1591,6 @@ class ProductRepository extends BaseRepository
|
||||
$product = $this->getSearch([])->find($id);
|
||||
$this->dao->update($id, $data);
|
||||
$status = $data['status'];
|
||||
$product_type = $product->product_type;
|
||||
$type = self::NOTIC_MSG[$data['status']][$product['product_type']];
|
||||
$message = '您有1个' . ($product['product_type'] ? '秒杀商品' : '商品') . self::NOTIC_MSG[$data['status']]['msg'];
|
||||
SwooleTaskService::merchant('notice', [
|
||||
@ -1596,7 +1601,7 @@ class ProductRepository extends BaseRepository
|
||||
'id' => $product['product_id']
|
||||
]
|
||||
], $product['mer_id']);
|
||||
app()->make(SpuRepository::class)->changeStatus($id,$product_type);
|
||||
app()->make(SpuRepository::class)->changeStatus($id,$product->product_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1611,6 +1616,7 @@ class ProductRepository extends BaseRepository
|
||||
{
|
||||
$productData = $this->getSearch([])->where('product_id','in', $id)->select();
|
||||
foreach ($productData as $product) {
|
||||
$product_type = $product['product_type'];
|
||||
$type = self::NOTIC_MSG[$data['status']][$product['product_type']];
|
||||
$message = '您有1个' . ($product['product_type'] ? '秒杀商品' : '商品') . self::NOTIC_MSG[$data['status']]['msg'];
|
||||
SwooleTaskService::merchant('notice', [
|
||||
@ -1623,7 +1629,7 @@ class ProductRepository extends BaseRepository
|
||||
], $product['mer_id']);
|
||||
}
|
||||
$this->dao->updates($id, $data);
|
||||
Queue(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product['product_type']]);
|
||||
Queue(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product_type]);
|
||||
event('product.status',compact('id','data'));
|
||||
}
|
||||
|
||||
@ -1749,15 +1755,15 @@ class ProductRepository extends BaseRepository
|
||||
$form = Elm::createForm(Route::buildUrl('systemStoreProductAddFicti', ['id' => $id])->build());
|
||||
$res = $this->dao->getWhere(['product_id' => $id], 'ficti,sales');
|
||||
$form->setRule([
|
||||
Elm::input('number', '现有虚拟销量', $res['ficti'])->readonly(true),
|
||||
Elm::input('number', '现有已售数量', $res['ficti'])->readonly(true),
|
||||
Elm::radio('type', '修改类型', 1)
|
||||
->setOptions([
|
||||
['value' => 1, 'label' => '增加'],
|
||||
['value' => 2, 'label' => '减少'],
|
||||
]),
|
||||
Elm::number('ficti', '修改虚拟销量数', 0),
|
||||
Elm::number('ficti', '修改已售数量', 0),
|
||||
]);
|
||||
return $form->setTitle('修改虚拟销量数');
|
||||
return $form->setTitle('修改已售数量');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2164,7 +2170,7 @@ class ProductRepository extends BaseRepository
|
||||
{
|
||||
$data = $this->dao->getWhere(['product_id' => $id, 'mer_id' => $merId]);
|
||||
if (!$data) throw new ValidateException('数据不存在');
|
||||
return app()->make(ProductAttrValueRepository::class)->getSearch(['product_id' => $id])->select();
|
||||
return app()->make(ProductAttrValueRepository::class)->getSearch(['product_id' => $id])->select()->append(['is_svip_price']);
|
||||
}
|
||||
|
||||
public function checkParams($data,$merId,$id = null)
|
||||
|
@ -24,6 +24,7 @@ class ProductSkuRepository extends BaseRepository
|
||||
$this->dao = $dao;
|
||||
}
|
||||
|
||||
const ACTIVE_TYPE_DISCOUNTS = 10;
|
||||
public function save(int $id, int $productId, array $data, $activeProductId = 0)
|
||||
{
|
||||
$storeProductServices = app()->make(ProductAttrValueRepository::class);
|
||||
@ -34,7 +35,7 @@ class ProductSkuRepository extends BaseRepository
|
||||
'active_id' => $id,
|
||||
'active_product_id' => $activeProductId,
|
||||
'product_id' => $productId,
|
||||
'active_type' => 10,
|
||||
'active_type' => self::ACTIVE_TYPE_DISCOUNTS,
|
||||
'price' => $skuData['price'],
|
||||
'active_price' => $item['active_price'] ?? $skuData['price'],
|
||||
'unique' => $item['unique'],
|
||||
|
@ -178,12 +178,11 @@ class SpuRepository extends BaseRepository
|
||||
$count = $query->count();
|
||||
|
||||
$list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select();
|
||||
$append = ['stop_time','show_svip_info','svip_price'];
|
||||
$append = ['stop_time','svip_price','show_svip_info','is_svip_price'];
|
||||
if ($productMake->getUserIsPromoter($userInfo))
|
||||
$append[] = 'max_extension';
|
||||
$list->append($append);
|
||||
$list = $this->getBorderList($list);
|
||||
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
@ -427,7 +426,7 @@ class SpuRepository extends BaseRepository
|
||||
break;
|
||||
case 4:
|
||||
$_make = app()->make(ProductGroupRepository::class);
|
||||
$wher[$_make->getPk()] = $id;
|
||||
$where[$_make->getPk()] = $id;
|
||||
$res = $_make->getWhere([$_make->getPk() => $id]);
|
||||
$where = [
|
||||
'activity_id' => $id,
|
||||
@ -436,15 +435,18 @@ class SpuRepository extends BaseRepository
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$where = [
|
||||
'activity_id' => 0,
|
||||
'product_id' => $id,
|
||||
'product_type' => 0,
|
||||
];
|
||||
break;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new ValidateException('数据不存在');
|
||||
}
|
||||
|
||||
if ($merId) $where['mer_id'] = $merId;
|
||||
$result = $this->dao->getSearch($where)->find();
|
||||
|
||||
if (!$result) throw new ValidateException('数据不存在');
|
||||
return $result;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class StoreDiscountRepository extends BaseRepository
|
||||
$res = activeProductSku($discountsProduct, 'discounts');
|
||||
$item['count'] = count($res['data']);
|
||||
$count = count(explode(',',$item['product_ids']));
|
||||
if ((!$item['type'] && $count == $item['count']) || ($item['type'] && $count > 1)) {
|
||||
if ((!$item['type'] && $count == $item['count']) || ($item['type'] && $count > 0)) {
|
||||
$item['max_price'] = $res['price'];
|
||||
$item['discountsProduct'] = $res['data'];
|
||||
$list[] = $item;
|
||||
@ -120,8 +120,6 @@ class StoreDiscountRepository extends BaseRepository
|
||||
$discountsData['is_show'] = $data['is_show'];
|
||||
$discountsData['mer_id'] = $data['mer_id'];
|
||||
$product_ids = [];
|
||||
|
||||
$storeDiscountsProductsServices = app()->make(StoreDiscountProductRepository::class);
|
||||
$productRepository = app()->make(ProductRepository::class);
|
||||
|
||||
foreach ($data['products'] as $product) {
|
||||
@ -145,17 +143,17 @@ class StoreDiscountRepository extends BaseRepository
|
||||
}
|
||||
|
||||
$discountsData['product_ids'] = implode(',', $product_ids);
|
||||
|
||||
return Db::transaction(function () use($data, $discountsData, $storeDiscountsProductsServices){
|
||||
return Db::transaction(function () use($data, $discountsData){
|
||||
if (isset($data['discount_id'])) {
|
||||
$discountsId = $data['discount_id'];
|
||||
$this->dao->update($discountsId, $discountsData);
|
||||
$storeDiscountsProductsServices->clear($discountsId);
|
||||
app()->make(StoreDiscountProductRepository::class)->clear($discountsId);
|
||||
app()->make(ProductSkuRepository::class)->clear($discountsId, ProductSkuRepository::ACTIVE_TYPE_DISCOUNTS);
|
||||
} else {
|
||||
$res = $this->dao->create($discountsData);
|
||||
$discountsId = $res['discount_id'];
|
||||
}
|
||||
$this->saveProduct($discountsId, $data['products'], $data['mer_id']);
|
||||
return $this->saveProduct($discountsId, $data['products'], $data['mer_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ class StoreServiceRepository extends BaseRepository
|
||||
$pwd->required();
|
||||
$confirm_pwd->required();
|
||||
}
|
||||
$adminRule = [];
|
||||
$adminRule = $filed = [];
|
||||
if($merId){
|
||||
$adminRule = [
|
||||
Elm::switches('customer', '订单管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(12),
|
||||
@ -98,7 +98,14 @@ class StoreServiceRepository extends BaseRepository
|
||||
]
|
||||
])
|
||||
];
|
||||
|
||||
}
|
||||
$filed = [
|
||||
"value" => 1,
|
||||
"rule" => [
|
||||
"customer","is_goods","is_verify","notify"
|
||||
]
|
||||
];
|
||||
$adminRule[] = Elm::number('sort', '排序', 0)->precision(0)->max(99999);
|
||||
$prefix = $merId ? config('admin.merchant_prefix') : config('admin.admin_prefix');
|
||||
return Elm::createForm(Route::buildUrl('merchantServiceCreate')->build(), array_merge([
|
||||
@ -107,7 +114,7 @@ class StoreServiceRepository extends BaseRepository
|
||||
Elm::input('nickname', '客服昵称')->required(),
|
||||
Elm::input('account', '客服账号')->required(),
|
||||
$pwd, $confirm_pwd,
|
||||
Elm::switches('is_open', '账号状态', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(12),
|
||||
Elm::switches('is_open', '账号状态', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(12)->control([$filed]),
|
||||
Elm::switches('status', '客服状态', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(12),
|
||||
], $adminRule))->setTitle('添加客服');
|
||||
}
|
||||
@ -146,12 +153,15 @@ class StoreServiceRepository extends BaseRepository
|
||||
* @author xaboy
|
||||
* @day 2020/5/29
|
||||
*/
|
||||
public function getChatService($merId, $uid)
|
||||
public function getChatService($merId, $uid = 0)
|
||||
{
|
||||
$logRepository = app()->make(StoreServiceLogRepository::class);
|
||||
$lastServiceId = $logRepository->getLastServiceId($merId, $uid);
|
||||
$service = null;
|
||||
if ($lastServiceId)
|
||||
if ($uid) {
|
||||
$logRepository = app()->make(StoreServiceLogRepository::class);
|
||||
$lastServiceId = $logRepository->getLastServiceId($merId, $uid);
|
||||
}
|
||||
|
||||
if (isset($lastServiceId) && $lastServiceId)
|
||||
$service = $this->getValidServiceInfo($lastServiceId);
|
||||
if ($service) return $service;
|
||||
$service = $this->dao->getRandService($merId);
|
||||
@ -162,7 +172,6 @@ class StoreServiceRepository extends BaseRepository
|
||||
{
|
||||
$order = $is_sys ? 'ASC' : 'DESC';
|
||||
$where['uid'] = $uid;
|
||||
$where['status'] = 1;
|
||||
$list = $this->search($where)->with(['merchant' => function ($query) {
|
||||
$query->field('mer_id,mer_avatar,mer_name');
|
||||
}])->order('mer_id '.$order)->select()->hidden(['pwd'])->toArray();
|
||||
|
@ -100,9 +100,10 @@ class StoreServiceUserRepository extends BaseRepository
|
||||
public function merUserList($merId, $uid, $page, $limit)
|
||||
{
|
||||
$service = app()->make(StoreServiceRepository::class)->getService($uid, $merId);
|
||||
if (!$service || !$service['status'])
|
||||
if (!$service)
|
||||
throw new ValidateException('没有权限');
|
||||
|
||||
if (!$service['status'])
|
||||
throw new ValidateException('客服已离线,清开启客服状态');
|
||||
return $this->serviceUserList(['service_id' => $service->service_id], $merId, $page, $limit);
|
||||
|
||||
}
|
||||
@ -111,13 +112,19 @@ class StoreServiceUserRepository extends BaseRepository
|
||||
{
|
||||
$query = $this->dao->search($where)->group('uid')->order('last_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->with(['user' => function ($query) {
|
||||
$query->field('uid,avatar,nickname,user_type,sex,is_promoter,phone,now_money,phone,birthday,spread_uid')->with(['spread' => function ($query) {
|
||||
$query->field('uid,avatar,nickname,cancel_time');
|
||||
}]);
|
||||
}, 'mark' => function ($query) use ($merId) {
|
||||
$query->where('mer_id', $merId)->bind(['mark' => 'extend_value']);
|
||||
}, 'last'])->setOption('field', [])->field('*,max(last_log_id) as last_log_id,sum(service_unread) as num')->select()->toArray();
|
||||
$list = $query->page($page, $limit)->with([
|
||||
'user' => function ($query) {
|
||||
$query->field('uid,avatar,nickname,user_type,sex,is_promoter,phone,now_money,phone,birthday,spread_uid')->with([
|
||||
'spread' => function ($query) {
|
||||
$query->field('uid,avatar,nickname,cancel_time');
|
||||
}
|
||||
]);
|
||||
},
|
||||
'mark' => function ($query) use ($merId) {
|
||||
$query->where('mer_id', $merId)->bind(['mark' => 'extend_value']);
|
||||
},
|
||||
'last'
|
||||
])->setOption('field', [])->field('*,max(last_log_id) as last_log_id,sum(service_unread) as num')->select()->toArray();
|
||||
if (count($list) && is_null($list[0]['service_user_id'])) {
|
||||
$list = [];
|
||||
}
|
||||
|
@ -212,7 +212,6 @@ HTML;
|
||||
{
|
||||
return [];
|
||||
$re = (Cache::get('AAAAAA'));
|
||||
//halt($re);
|
||||
unset($re['省市编码']);
|
||||
if (!$re) throw new ValidateException('无数据');
|
||||
$shen = [];
|
||||
|
@ -108,17 +108,18 @@ class ConfigRepository extends BaseRepository
|
||||
|
||||
if ($config['required']) $component->required();
|
||||
|
||||
$component->appendRule('suffix', [
|
||||
'type' => 'div',
|
||||
'style' => ['color' => '#999999'],
|
||||
'domProps' => [
|
||||
'innerHTML' => $config['info'],
|
||||
]
|
||||
]);
|
||||
|
||||
if ($config['config_props'] ?? '') {
|
||||
$props = @parse_ini_string($config['config_props'], false, INI_SCANNER_TYPED);
|
||||
if (is_array($props)) {
|
||||
$guidance_uri = $props['guidance_uri'] ?? '';
|
||||
$guidance_image = $props['guidance_image'] ?? '';
|
||||
if ($guidance_image) {
|
||||
$config['guidance'] = [
|
||||
'uri' => $guidance_uri,
|
||||
'image' => $guidance_image,
|
||||
];
|
||||
}
|
||||
unset($props['guidance_image'], $props['guidance_uri']);
|
||||
$component->props($props);
|
||||
if (isset($props['required']) && $props['required']) {
|
||||
$component->required();
|
||||
@ -128,6 +129,16 @@ class ConfigRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($config['info']) {
|
||||
$component->appendRule('suffix', [
|
||||
'type' => 'guidancePop',
|
||||
'props' => [
|
||||
'info' => $config['info'],
|
||||
'url' => $config['guidance']['uri'] ?? '',
|
||||
'image' => $config['guidance']['image'] ?? '',
|
||||
]
|
||||
]);
|
||||
}
|
||||
return $component;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ class FinancialRepository extends BaseRepository
|
||||
'type' => 'span',
|
||||
'title' => '商户名称:',
|
||||
'native' => false,
|
||||
'children' => [$merchant->mer_name]
|
||||
'children' => ["$merchant->mer_name"]
|
||||
],
|
||||
[
|
||||
'type' => 'span',
|
||||
@ -151,13 +151,13 @@ class FinancialRepository extends BaseRepository
|
||||
'type' => 'span',
|
||||
'title' => '商户余额:',
|
||||
'native' => false,
|
||||
'children' => [$merchant->mer_money]
|
||||
'children' => ["$merchant->mer_money"]
|
||||
],
|
||||
[
|
||||
'type' => 'span',
|
||||
'native' => false,
|
||||
'title' => '商户可提现金额:',
|
||||
'children' => [$_extract]
|
||||
'children' => ["$_extract"]
|
||||
],
|
||||
|
||||
Elm::radio('financial_type', '转账类型:', $merchant->financial_type)
|
||||
|
@ -104,7 +104,6 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
$create = $data['create_mer'] == 1;
|
||||
unset($data['create_mer']);
|
||||
$intention = $this->search(['mer_intention_id' => $id])->find();
|
||||
$smsData = [];
|
||||
if (!$intention)
|
||||
throw new ValidateException('信息不存在');
|
||||
if ($intention->status)
|
||||
@ -124,29 +123,22 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
'category_id' => $intention['merchant_category_id'],
|
||||
'type_id' => $intention['mer_type_id'],
|
||||
'real_name' => $intention['name'],
|
||||
'uid'=>$intention['uid'],
|
||||
'status' => 1,
|
||||
'is_audit' => 1,
|
||||
'is_bro_room' => $config['broadcast_room_type'] == 1 ? 0 : 1,
|
||||
'is_bro_goods' => $config['broadcast_goods_type'] == 1 ? 0 : 1,
|
||||
'mer_password' => $password,
|
||||
'is_margin' => $margin['is_margin'] ?? -1,
|
||||
'margin' => $margin['margin'] ?? 0,
|
||||
'area_id' => $intention['area_id'] ?? 0,
|
||||
'geo_street' => $intention['street_id'] ?? 0,
|
||||
'village_id' => $intention['village_id'] ?? 0,
|
||||
'is_nmsc' => $intention['is_nmsc'] ?? 0,
|
||||
'margin' => $margin['margin'] ?? 0
|
||||
];
|
||||
$data['fail_msg'] = '';
|
||||
$smsData = [
|
||||
'date' => date('m月d日', strtotime($intention->create_time)),
|
||||
'mer' => $intention['mer_name'],
|
||||
'phone' => $intention['phone'],
|
||||
'pwd' => $password ?? '',
|
||||
'site_name' => systemConfig('site_name'),
|
||||
];
|
||||
if ($data['status'] == 1) {
|
||||
$data['fail_msg'] = '';
|
||||
$smsData = [
|
||||
'date' => date('m月d日', strtotime($intention->create_time)),
|
||||
'mer' => $intention['mer_name'],
|
||||
'phone' => $intention['phone'],
|
||||
'pwd' => $password ?? '',
|
||||
'site_name' => systemConfig('site_name'),
|
||||
];
|
||||
}
|
||||
}
|
||||
if ($data['status'] == 2) {
|
||||
$smsData = [
|
||||
|
@ -343,7 +343,7 @@ class MerchantRepository extends BaseRepository
|
||||
{
|
||||
$merchant = $this->dao->apiGetOne($id)->hidden([
|
||||
"real_name", "mer_phone", "reg_admin_id", "sort", "is_del", "is_audit", "is_best", "mer_state", "bank", "bank_number", "bank_name", 'update_time',
|
||||
'financial_alipay', 'financial_bank', 'financial_wechat', 'financial_type'
|
||||
'financial_alipay', 'financial_bank', 'financial_wechat', 'financial_type','mer_take_phone'
|
||||
]);
|
||||
$merchant->append(['type_name', 'isset_certificate', 'services_type']);
|
||||
$merchant['care'] = false;
|
||||
|
@ -87,13 +87,4 @@ class ServeMealRepository extends BaseRepository
|
||||
$this->dao->getSearch($param)->finid();
|
||||
|
||||
}
|
||||
|
||||
public function setOrderSn()
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = 'cs' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody\data;
|
||||
use app\common\dao\system\serve\ServeOrderDao;
|
||||
use app\common\model\system\serve\ServeOrder;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use app\common\repositories\store\product\ProductCopyRepository;
|
||||
use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
@ -136,7 +137,7 @@ class ServeOrderRepository extends BaseRepository
|
||||
$param = $res['param'];
|
||||
|
||||
if(!$result = Cache::store('file')->get($key)){
|
||||
$order_sn = $this->setOrderSn(null);
|
||||
$order_sn = app()->make(StoreOrderRepository::class)->getNewOrderId('cs');
|
||||
$param['order_sn'] = $order_sn;
|
||||
$param['body'] = $order_sn;
|
||||
$payType = $data['pay_type'] == 1 ? 'weixinQr' : 'alipayQr';
|
||||
@ -216,13 +217,6 @@ class ServeOrderRepository extends BaseRepository
|
||||
return ;
|
||||
}
|
||||
|
||||
public function setOrderSn($profix)
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = ($profix ?:'cs') . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
|
||||
public function getList(array $where, int $page, int $limit)
|
||||
{
|
||||
|
@ -187,24 +187,33 @@ class UserExtractRepository extends BaseRepository
|
||||
$brokerage_price = 0;
|
||||
if($data['status'] == -1)
|
||||
$brokerage_price = bcadd($user['brokerage_price'] ,$extract['extract_price'],2);
|
||||
|
||||
$type = systemConfig('sys_extension_type');
|
||||
$ret = [];
|
||||
if ($data['status'] == 1 && $extract['extract_type'] == 3) {
|
||||
$openid = app()->make(WechatUserRepository::class)->idByOpenId((int)$user['wechat_user_id']);
|
||||
if (!$openid) {
|
||||
$openid = app()->make(WechatUserRepository::class)->idByRoutineId((int)$user['wechat_user_id']);
|
||||
}
|
||||
if (!$openid) throw new ValidateException('非微信用户不支持付款到零钱');
|
||||
$service = null;
|
||||
$func = null;
|
||||
if ($data['status'] == 1 && $extract['extract_type'] == 3 && in_array($type,[1,2])) {
|
||||
$func = $type == 1 ? 'merchantPay' : 'companyPay';
|
||||
$ret = [
|
||||
'openid' => $openid,
|
||||
'sn' => $extract['extract_sn'],
|
||||
'price' => $extract['extract_price']
|
||||
'price' => $extract['extract_price'],
|
||||
'mark' => '企业付款给用户:'.$user->nickname,
|
||||
'batch_name' => '企业付款给用户:'.$user->nickname
|
||||
];
|
||||
$openid = app()->make(WechatUserRepository::class)->idByOpenId((int)$user['wechat_user_id']);
|
||||
if ($openid) {
|
||||
$ret['openid'] = $openid;
|
||||
$service = WechatService::create();
|
||||
} else {
|
||||
$routineOpenid = app()->make(WechatUserRepository::class)->idByRoutineId((int)$user['wechat_user_id']);
|
||||
if (!$routineOpenid) throw new ValidateException('非微信用户不支持付款到零钱');
|
||||
$ret['openid'] = $routineOpenid;
|
||||
$service = MiniProgramService::create();
|
||||
}
|
||||
}
|
||||
|
||||
Db::transaction(function()use($id,$data,$ret,$user,$brokerage_price){
|
||||
Db::transaction(function()use($id,$data,$user,$brokerage_price,$ret,$service,$func){
|
||||
event('user.extractStatus.before',compact('id','data'));
|
||||
if ($ret) WechatService::create()->merchantPay($ret);
|
||||
if ($ret) $service->{$func}($ret);
|
||||
if($brokerage_price){
|
||||
$user->brokerage_price = $brokerage_price;
|
||||
$user->save();
|
||||
@ -223,4 +232,9 @@ class UserExtractRepository extends BaseRepository
|
||||
$sn = 'ue' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $sn;
|
||||
}
|
||||
|
||||
public function getHistoryBank($uid)
|
||||
{
|
||||
return $this->dao->getSearch(['uid' => $uid,'extract_type' => 0])->order('create_time DESC')->field('real_name,bank_code,bank_address,bank_name')->find();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ namespace app\common\repositories\user;
|
||||
use app\common\dao\user\LabelRuleDao;
|
||||
use app\common\dao\user\UserOrderDao;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use app\common\repositories\system\groupData\GroupDataRepository;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
use crmeb\services\PayService;
|
||||
@ -59,20 +60,6 @@ class UserOrderRepository extends BaseRepository
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 获取订单号
|
||||
* @return string
|
||||
* @author Qinii
|
||||
* @day 2022/11/12
|
||||
*/
|
||||
public function setOrderSn()
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = 'wxs' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return mixed
|
||||
@ -81,7 +68,7 @@ class UserOrderRepository extends BaseRepository
|
||||
*/
|
||||
public function add($res, $user, $params)
|
||||
{
|
||||
$order_sn = $this->setOrderSn();
|
||||
$order_sn = app()->make(StoreOrderRepository::class)->getNewOrderId(StoreOrderRepository::TYPE_SN_USER_ORDER);
|
||||
$data = [
|
||||
'title' => $res['value']['svip_name'],
|
||||
'link_id' => $res->group_data_id,
|
||||
@ -108,7 +95,7 @@ class UserOrderRepository extends BaseRepository
|
||||
$info = $this->dao->create($data);
|
||||
if ($data['pay_price']){
|
||||
try {
|
||||
$service = new PayService($type,$body);
|
||||
$service = new PayService($type,$body, 'user_order');
|
||||
$config = $service->pay($user);
|
||||
return app('json')->status($type, $config + ['order_id' => $info->order_id]);
|
||||
} catch (\Exception $e) {
|
||||
@ -178,7 +165,7 @@ class UserOrderRepository extends BaseRepository
|
||||
$ret->end_time = $svip_endtime;
|
||||
$ret->save();
|
||||
$date = $info->svip_type == 3 ? '终身会员' : $svip_endtime;
|
||||
Queue::push(SendSmsJob::class,['tempId' => 'SVIP_PAY_SUCCESS','id' => ['phone' => $user->phone, 'date' => $date]]);
|
||||
if ($user->phone) Queue::push(SendSmsJob::class,['tempId' => 'SVIP_PAY_SUCCESS','id' => ['phone' => $user->phone, 'date' => $date]]);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
@ -101,24 +101,28 @@ class UserRelationRepository extends BaseRepository
|
||||
public function search(array $where, int $page, int $limit)
|
||||
{
|
||||
$with = [];
|
||||
if($where['type'] == 1) $with = ['spu'];
|
||||
if($where['type'] == 1) $with = [
|
||||
'spu'
|
||||
];
|
||||
if($where['type'] == 10) $with = [
|
||||
'merchant' => function($query){
|
||||
$query->field('mer_id,type_id,mer_name,mer_avatar,sales,mer_info,care_count');
|
||||
$query->where('status',1)->where('mer_state',1)->where('is_del',0)->field('mer_id,type_id,mer_name,mer_avatar,sales,mer_info,care_count,status,is_del,mer_state');
|
||||
}
|
||||
];
|
||||
$query = $this->dao->search($where);
|
||||
$query->with($with)->order('create_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
$make = app()->make(ProductRepository::class);
|
||||
foreach ($list as $item) {
|
||||
if(isset($item['spu']['product_type']) && $item['spu']['product_type'] == 1){
|
||||
$item['spu']['stop_time'] = $item->stop_time;
|
||||
unset($item['spu']['seckillActive']);
|
||||
}
|
||||
if (isset($item['merchant']) && $item['merchant'] ) {
|
||||
$item['merchant']['showProduct'] = $item['merchant']['AllRecommend'];
|
||||
foreach ($list as &$item) {
|
||||
if ($item['type'] == 1) {
|
||||
if(isset($item['spu']['product_type']) && $item['spu']['product_type'] == 1){
|
||||
$item['spu']['stop_time'] = $item->stop_time;
|
||||
unset($item['spu']['seckillActive']);
|
||||
}
|
||||
} else {
|
||||
if (isset($item['merchant']) && $item['merchant']) {
|
||||
$item['merchant']['showProduct'] = $item['merchant']['AllRecommend'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return compact('count', 'list');
|
||||
@ -166,31 +170,27 @@ class UserRelationRepository extends BaseRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* TODO 批量删除
|
||||
* @param array $ids
|
||||
* @param $uid
|
||||
* @param $type
|
||||
* @author Qinii
|
||||
* @day 2023/2/16
|
||||
*/
|
||||
public function destory(array $data,$lst = 0)
|
||||
public function batchDestory(array $ids,$uid, $type = 1)
|
||||
{
|
||||
if($lst){
|
||||
$id = $data['type_id'];
|
||||
$make = app()->make(ProductRepository::class);
|
||||
}else{
|
||||
if(in_array($data['type'],[0,1,2,3,4])) {
|
||||
$spu = $this->getSpu($data);
|
||||
$data['type_id'] = $spu->spu_id;
|
||||
$id = $spu['product_id'];
|
||||
$data['type'] = 1;
|
||||
$make = app()->make(ProductRepository::class);
|
||||
}
|
||||
if($data['type'] == 10){
|
||||
$id = $data['type_id'];
|
||||
$make = app()->make(MerchantRepository::class);
|
||||
if ($type == 10) {
|
||||
app()->make(MerchantRepository::class)->decCareCount($ids);
|
||||
$type_id = $ids;
|
||||
} else {
|
||||
foreach ($ids as $id) {
|
||||
$spu = $this->getSpu(['type_id' => $id, 'type' => $type]);
|
||||
$type_id[] = $spu->spu_id;
|
||||
}
|
||||
$type = 1;
|
||||
app()->make(ProductRepository::class)->decCareCount($ids);
|
||||
}
|
||||
return Db::transaction(function()use($data,$make,$id){
|
||||
$make->decCareCount($id);
|
||||
$this->dao->destory($data);
|
||||
});
|
||||
return $this->dao->search(['uid' => $uid,'type' => $type])->where('type_id','in',$type_id)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -495,6 +495,9 @@ class UserRepository extends BaseRepository
|
||||
$request = request();
|
||||
|
||||
if ($user) {
|
||||
// if ($wechatUser['nickname'] == '微信用户') {
|
||||
// unset($wechatUser['nickname'],$wechatUser['headimgurl']);
|
||||
// }
|
||||
$user->save(array_filter([
|
||||
'nickname' => $wechatUser['nickname'] ?? '',
|
||||
'avatar' => $wechatUser['headimgurl'] ?? '',
|
||||
@ -1388,6 +1391,10 @@ class UserRepository extends BaseRepository
|
||||
app()->make(StoreServiceRepository::class)->getSearch([])->where('uid', $uid)->update(['uid' => 0, 'status' => 0, 'is_open' => 0]);
|
||||
$this->getSearch([])->where('spread_uid', $uid)->update(['spread_uid' => 0]);
|
||||
$this->delBrokerageTop($uid);
|
||||
//TODO 推广人月榜
|
||||
Cache::zrem('s_top_' . date('Y-m'), $uid);
|
||||
//TODO 推广人周榜
|
||||
Cache::zrem('s_top_' . monday(), $uid);
|
||||
app()->make(CommunityRepository::class)->destoryByUid($uid);
|
||||
});
|
||||
}
|
||||
@ -1397,16 +1404,27 @@ class UserRepository extends BaseRepository
|
||||
$formData = $this->dao->get($id);
|
||||
if (!$formData) throw new ValidateException('数据不存在');
|
||||
$form = Elm::createForm(Route::buildUrl('systemUserSvipUpdate', ['id' => $id])->build());
|
||||
$form->setRule([
|
||||
$rule = [
|
||||
Elm::switches('is_svip', '付费会员', $formData->is_svip > 0 ? 1 : 0)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开'),
|
||||
Elm::radio('type', '修改类型', 1)->options([
|
||||
];
|
||||
if ($formData->is_svip == 3) {
|
||||
$rule[] = Elm::input('is_svip_type', '会员类型','永久会员')->disabled(true)->appendRule('suffix', [
|
||||
'type' => 'div',
|
||||
'style' => ['color' => '#999999'],
|
||||
'domProps' => [
|
||||
'innerHTML' =>'永久会员,若关闭后再次开启将不再是永久会员,请谨慎操作',
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
$rule[] = Elm::radio('type', '修改类型', 1)->options([
|
||||
['label' => '增加', 'value' => 1],
|
||||
['label' => '减少', 'value' => 0],
|
||||
])->requiredNum(),
|
||||
Elm::number('add_time', '付费会员期限(天)')->required()->min(1),
|
||||
Elm::input('end_time', '当前有效期期限', $formData->is_svip > 0 ? $formData->svip_endtime : 0)->disabled(true),
|
||||
]);
|
||||
return $form->setTitle( '编辑付费会员期限' );
|
||||
])->requiredNum();
|
||||
$rule[] = Elm::number('add_time', '会员期限(天)')->required()->min(1);
|
||||
$rule[] = Elm::input('end_time', '当前有效期期限', $formData->is_svip > 0 ? $formData->svip_endtime : 0)->disabled(true);
|
||||
}
|
||||
$form->setRule($rule);
|
||||
return $form->setTitle( '编辑付费会员期限');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1441,7 +1459,7 @@ class UserRepository extends BaseRepository
|
||||
$res = [
|
||||
'title' => $data['is_svip'] == 0 ? '平台取消会员资格' : ($data['type'] ? '平台赠送' : '平台扣除'),
|
||||
'link_id' => 0,
|
||||
'order_sn' => $make->setOrderSn(),
|
||||
'order_sn' => app()->make(StoreOrderRepository::class)->getNewOrderId(StoreOrderRepository::TYPE_SN_USER_ORDER),
|
||||
'pay_price' => 0,
|
||||
'order_info' => json_encode($data,JSON_UNESCAPED_UNICODE),
|
||||
'uid' => $id,
|
||||
@ -1461,4 +1479,20 @@ class UserRepository extends BaseRepository
|
||||
$user->save();
|
||||
});
|
||||
}
|
||||
|
||||
public function updateBaseInfo($data, $user)
|
||||
{
|
||||
Db::transaction(function() use($data, $user){
|
||||
$user->save(array_filter([
|
||||
'nickname' => $data['nickname'] ?? '',
|
||||
'avatar' => $data['avatar'] ?? '',
|
||||
]));
|
||||
if (isset($user->wechat) ) {
|
||||
$user->wechat->save(array_filter([
|
||||
'nickname' => $data['nickname'] ?? '',
|
||||
'headimgurl' => $data['avatar'] ?? '',
|
||||
]));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ class WechatUserRepository extends BaseRepository
|
||||
$wechatUser = $this->dao->routineIdByWechatUser($routineOpenid);
|
||||
return Db::transaction(function () use ($createUser, $routineInfo, $wechatUser) {
|
||||
if ($wechatUser) {
|
||||
// $routineInfo['nickname'] = $wechatUser['nickname'];
|
||||
// $routineInfo['headimgurl'] = $wechatUser['headimgurl'];
|
||||
$routineInfo['nickname'] = $wechatUser['nickname'];
|
||||
$routineInfo['headimgurl'] = $wechatUser['headimgurl'];
|
||||
$wechatUser->save($routineInfo);
|
||||
} else {
|
||||
$wechatUser = $this->dao->create($routineInfo);
|
||||
|
@ -146,7 +146,9 @@ class Order extends BaseController
|
||||
public function status($id)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
return app('json')->success($this->repository->getOrderStatus($id, $page, $limit));
|
||||
$where = $this->request->params(['date','user_type']);
|
||||
$where['id'] = $id;
|
||||
return app('json')->success($this->repository->getOrderStatus($where, $page, $limit));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,4 +189,16 @@ class Order extends BaseController
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param $id
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 2023/2/22
|
||||
*/
|
||||
public function childrenList($id)
|
||||
{
|
||||
$data = $this->repository->childrenList($id, 0);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ class StoreBrandCategory extends BaseController
|
||||
public function create(validate $validate)
|
||||
{
|
||||
$data = $this->checkParams($validate);
|
||||
|
||||
if ($data['pid'] && !$this->repository->merExists($this->request->merId(), $data['pid']))
|
||||
return app('json')->fail('上级分类不存在');
|
||||
if ($data['pid'] && !$this->repository->checkLevel($data['pid']))
|
||||
|
@ -49,7 +49,7 @@ class StoreProduct extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['cate_id', 'keyword', ['type', 1], 'mer_cate_id', 'pid','store_name','is_trader','us_status','product_id','star','sys_labels','hot_type']);
|
||||
$where = $this->request->params(['cate_id', 'keyword', ['type', 1], 'mer_cate_id', 'pid','store_name','is_trader','us_status','product_id','star','sys_labels','hot_type','svip_price_type']);
|
||||
$mer_id = $this->request->param('mer_id','');
|
||||
$merId = $mer_id ? $mer_id : null;
|
||||
$where['is_gift_bag'] = 0;
|
||||
@ -207,10 +207,10 @@ class StoreProduct extends BaseController
|
||||
{
|
||||
$data = $this->request->params(['type','ficti']);
|
||||
if(!in_array($data['type'],[1,2])) return app('json')->fail('类型错误');
|
||||
if(!$data['ficti'] || $data['ficti'] < 0) return app('json')->fail('虚拟销量必须大于0');
|
||||
if(!$data['ficti'] || $data['ficti'] < 0) return app('json')->fail('已售数量必须大于0');
|
||||
$res = $this->repository->getWhere(['product_id' => $id],'ficti,sales');
|
||||
if(!$res) return app('json')->fail('数据不存在');
|
||||
if($data['type'] == 2 && $res['ficti'] < $data['ficti']) return app('json')->fail('虚拟销量不足');
|
||||
if($data['type'] == 2 && $res['ficti'] < $data['ficti']) return app('json')->fail('已售数量不足');
|
||||
$ficti = ($data['type'] == 1) ? $data['ficti'] : '-' . $data['ficti'];
|
||||
$data = [
|
||||
'ficti' => $res['ficti'] + $ficti,
|
||||
|
@ -248,18 +248,6 @@ class Config extends BaseController
|
||||
return app('json')->success(['src' => $res]);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @author Qinii
|
||||
* @day 2023/1/5
|
||||
*/
|
||||
public function specificFileUpload()
|
||||
{
|
||||
$file = $this->request->file('file');
|
||||
$type = $this->request->param('fiel_type');
|
||||
halt($type,$file);
|
||||
}
|
||||
|
||||
public function uploadWechatSet()
|
||||
{
|
||||
$name = $this->request->param('wechat_chekc_file');
|
||||
@ -343,7 +331,7 @@ class Config extends BaseController
|
||||
{
|
||||
$data['routine_name'] = systemConfig('routine_name');
|
||||
$data['routine_appId'] = systemConfig('routine_appId');
|
||||
$data['url'] = 'https://wiki.crmeb.net/web/mer/mer/1771';
|
||||
$data['url'] = 'https://doc.crmeb.com/mer/mer2/4491';
|
||||
$data['site_url'] = rtrim(systemConfig('site_url'), '/') . '/pages/index/index';
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
@ -78,17 +78,13 @@ class Diy extends BaseController
|
||||
$infoDiy = $id ? $this->repository->getWhere(['id' => $id, 'mer_id' => $data['mer_id']]) : [];
|
||||
if ($infoDiy && $infoDiy['is_default'])
|
||||
return app('json')->fail('默认模板不能修改');
|
||||
if ($infoDiy && $infoDiy['is_diy']) {
|
||||
foreach ($value as $key => &$item) {
|
||||
if ($infoDiy) {
|
||||
foreach ($value as $k => $item) {
|
||||
if ($item['name'] === 'goodList') {
|
||||
if (isset($item['selectConfig']['list'])) {
|
||||
unset($item['selectConfig']['list']);
|
||||
}
|
||||
if (isset($item['goodsList']['list']) && is_array($item['goodsList']['list'])) {
|
||||
$limitMax = config('database.page.limitMax', 50);
|
||||
if (isset($item['numConfig']['val']) && isset($item['tabConfig']['tabVal']) && $item['tabConfig']['tabVal'] == 0 && $item['numConfig']['val'] > $limitMax) {
|
||||
return app('json')->fail('您设置得商品个数超出系统限制,最大限制' . $limitMax . '个商品');
|
||||
}
|
||||
$item['goodsList']['ids'] = array_column($item['goodsList']['list'], 'product_id');
|
||||
unset($item['goodsList']['list']);
|
||||
}
|
||||
@ -99,6 +95,7 @@ class Diy extends BaseController
|
||||
} elseif ($item['name'] === 'promotionList') {
|
||||
unset($item['productList']['list']);
|
||||
}
|
||||
$value[$k] = $item;
|
||||
}
|
||||
$data['value'] = json_encode($value);
|
||||
} else {
|
||||
@ -127,7 +124,7 @@ class Diy extends BaseController
|
||||
} elseif (isset($value['selectList']['list']) && is_array($value['selectList']['list'])) {
|
||||
unset($value['goodsList']['list']);
|
||||
}
|
||||
$data['value'] = json_encode($value,JSON_UNESCAPED_UNICODE);
|
||||
$data['value'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$data['version'] = '1.0';
|
||||
return app('json')->success($id ? '修改成功' : '保存成功',
|
||||
|
@ -118,6 +118,7 @@ class Merchant extends BaseController
|
||||
{
|
||||
if (!$this->repository->exists($id))
|
||||
return app('json')->fail('数据不存在');
|
||||
|
||||
return app('json')->success(formToData($this->repository->updateForm($id)));
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ class StoreService extends BaseController
|
||||
$status = $this->request->param('status');
|
||||
if (!$this->repository->merExists($this->request->merId(), $id))
|
||||
return app('json')->fail('数据不存在');
|
||||
$this->repository->update($id, ['status' => $status == 1 ? 1 : 0]);
|
||||
$this->repository->update($id, ['is_open' => $status == 1 ? 1 : 0]);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
||||
use app\common\repositories\system\notice\SystemNoticeConfigRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
use app\common\repositories\user\UserSignRepository;
|
||||
use app\common\repositories\wechat\CustomTemplate;
|
||||
use app\common\repositories\wechat\RoutineQrcodeRepository;
|
||||
use app\common\repositories\wechat\WechatUserRepository;
|
||||
@ -43,6 +44,7 @@ use think\facade\Log;
|
||||
use think\facade\Queue;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* Class Auth
|
||||
* @package app\controller\api
|
||||
@ -53,6 +55,9 @@ class Auth extends BaseController
|
||||
{
|
||||
public function test()
|
||||
{
|
||||
$data = ['tempId' => 'ORDER_CREATE', 'id' => 658];
|
||||
$a = app()->make(WechatTemplateMessageService::class)->sendTemplate($data);
|
||||
halt($a);
|
||||
$data = [
|
||||
'first' => '您有新的生成订单请注意查看',
|
||||
'keyword1' => '手动阀手动阀',
|
||||
@ -60,9 +65,9 @@ class Auth extends BaseController
|
||||
'keyword3' => '环境开会艰苦环境',
|
||||
'remark' => '查看详情'
|
||||
];
|
||||
$openid='ob5SYwbHHYQUS5mpzKEz4lo7zowA';
|
||||
$templateId='8g6xSS-WPaP4Jm1Fwno4uqRxpo4TLYyiVwudL4svUPc';
|
||||
$a= (new CustomTemplate)->post($data,$openid,$templateId);
|
||||
$openid = 'ob5SYwbHHYQUS5mpzKEz4lo7zowA';
|
||||
$templateId = '8g6xSS-WPaP4Jm1Fwno4uqRxpo4TLYyiVwudL4svUPc';
|
||||
$a = (new CustomTemplate)->post($data, $openid, $templateId);
|
||||
halt($a);
|
||||
// Queue::push(SendSmsJob::class,$data);
|
||||
// $status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']);
|
||||
@ -156,36 +161,31 @@ class Auth extends BaseController
|
||||
$data['total_consume'] = $user['pay_price'];
|
||||
$data['extension_status'] = systemConfig('extension_status');
|
||||
if (systemConfig('member_status')) $data['member_icon'] = $this->request->userInfo()->member->brokerage_icon ?? '';
|
||||
if ($data['is_svip'] == 3) $data['svip_endtime'] = date('Y-m-d H:i:s',strtotime("+100 year"));
|
||||
|
||||
$find = Db::name('user')->find($user['uid']);
|
||||
if ($data['is_svip'] == 3) $data['svip_endtime'] = date('Y-m-d H:i:s', strtotime("+100 year"));
|
||||
|
||||
$data['no_update'] = 1;
|
||||
$msg = Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id', $user['uid'])->find();
|
||||
|
||||
if ($find){
|
||||
$msg = Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id', $user['uid'])->find();
|
||||
if ($msg){
|
||||
$data['no_update']=0;
|
||||
}
|
||||
$data['group_id']=$find['group_id'];
|
||||
if ($msg) {
|
||||
$data['no_update'] = 0;
|
||||
}
|
||||
$data['group_id'] = $user['group_id'];
|
||||
|
||||
// 新增返回商户后台登录地址
|
||||
$data['merchant_login'] = $this->request->domain().'/merchant';
|
||||
$data['merchant_login'] = $this->request->domain() . '/merchant';
|
||||
$data['is_wsxx'] = 0;
|
||||
|
||||
$data['mer_info']=[];
|
||||
$data['mer_info'] = [];
|
||||
// 判断是否是商户,并且有没有完善信息
|
||||
//这里有点小问题以后要修改
|
||||
$store_service=Db::name('store_service')->where('uid',$data['uid'])->find();
|
||||
if ($store_service){
|
||||
$mer_arr = Db::name('merchant')->where('mer_id',$store_service['mer_id'])->where('is_del',0)->where('status',1)->field('type_id,mer_avatar,mer_banner,mer_info,service_phone,mer_address,uid,mer_name')->find();
|
||||
if($mer_arr && $mer_arr['mer_avatar']!=''&& $mer_arr['mer_banner'] !='' && $mer_arr['mer_info'] && $mer_arr['service_phone']!=''&& $mer_arr['mer_address']!=''){
|
||||
$store_service = Db::name('store_service')->where('uid', $data['uid'])->find();
|
||||
if ($store_service) {
|
||||
$mer_arr = Db::name('merchant')->where('mer_id', $store_service['mer_id'])->where('is_del', 0)->where('status', 1)->field('type_id,mer_avatar,mer_banner,mer_info,service_phone,mer_address,uid,mer_name')->find();
|
||||
if ($mer_arr && $mer_arr['mer_avatar'] != '' && $mer_arr['mer_banner'] != '' && $mer_arr['mer_info'] && $mer_arr['service_phone'] != '' && $mer_arr['mer_address'] != '') {
|
||||
$data['is_wsxx'] = 1;
|
||||
}
|
||||
$data['mer_info']=$mer_arr;
|
||||
$data['mer_info'] = $mer_arr;
|
||||
}
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
@ -375,8 +375,8 @@ class Auth extends BaseController
|
||||
{
|
||||
$data = $this->request->params(['phone', 'sms_code', 'spread', 'auth_token',['user_type','h5']]);
|
||||
$validate->sceneSmslogin()->check($data);
|
||||
$sms_code = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['sms_code'], 'login');
|
||||
if (!$sms_code) return app('json')->fail('验证码不正确');
|
||||
$sms_code = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['sms_code'], 'login');
|
||||
if (!$sms_code) return app('json')->fail('验证码不正确');
|
||||
$user = $repository->accountByUser($data['phone']);
|
||||
$auth = $this->parseAuthToken($data['auth_token']);
|
||||
Db::startTrans();
|
||||
@ -408,7 +408,7 @@ class Auth extends BaseController
|
||||
Db::rollback();
|
||||
return app('json')->error($e->getMessage());
|
||||
}
|
||||
if ($auth && !$user['wechat_user_id']){
|
||||
if ($auth && !$user['wechat_user_id']) {
|
||||
$repository->syncBaseAuth($auth, $user);
|
||||
}
|
||||
$user = $repository->mainUser($user);
|
||||
@ -416,18 +416,18 @@ class Auth extends BaseController
|
||||
|
||||
$tokenInfo = $repository->createToken($user);
|
||||
$repository->loginAfter($user);
|
||||
$user['no_update']=1;
|
||||
$user['no_update'] = 1;
|
||||
$user['group_ids'] = $user['group_id'];
|
||||
$msg=Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id',$user['uid'])->find();
|
||||
if ($msg){
|
||||
$user['no_update']=0;
|
||||
$ddd['phone'] = $data['phone'];
|
||||
Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id',$user['uid'])->update($ddd);
|
||||
}
|
||||
$msg = Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id', $user['uid'])->find();
|
||||
if ($msg) {
|
||||
$user['no_update'] = 0;
|
||||
$ddd['phone'] = $data['phone'];
|
||||
Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id', $user['uid'])->update($ddd);
|
||||
}
|
||||
|
||||
if ($user['phone']==''){
|
||||
Db::name('user')->where('uid',$user['uid'])->update(['phone'=>$user['account']]);
|
||||
$user['phone']=$user['account'];
|
||||
if ($user['phone'] == '') {
|
||||
Db::name('user')->where('uid', $user['uid'])->update(['phone' => $user['account']]);
|
||||
$user['phone'] = $user['account'];
|
||||
}
|
||||
return app('json')->success($repository->returnToken($user, $tokenInfo));
|
||||
}
|
||||
@ -610,15 +610,15 @@ class Auth extends BaseController
|
||||
if ($auth['auth']['spread'] ?? 0) {
|
||||
$userRepository->bindSpread($user, (int)($auth['auth']['spread']));
|
||||
}
|
||||
$uid = Db::name('user')->where('wechat_user_id',$authInfo['wechat_user_id'])->value('uid');
|
||||
$find=Db::name('nk_user')->where('user_id',$uid)->find();
|
||||
$user['no_update']=1;
|
||||
$uid = Db::name('user')->where('wechat_user_id', $authInfo['wechat_user_id'])->value('uid');
|
||||
$find = Db::name('nk_user')->where('user_id', $uid)->find();
|
||||
$user['no_update'] = 1;
|
||||
$user['group_ids'] = 1;
|
||||
if ($find && $find['n_user_id']!=0){
|
||||
if ($find && $find['n_user_id'] != 0) {
|
||||
$user['group_ids'] = $find['group_id'];
|
||||
$msg=Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id',$find['n_user_id'])->cache(true)->find();
|
||||
if ($msg){
|
||||
$user['no_update']=0;
|
||||
$msg = Db::connect('nongke')->table('fa_szxc_information_usermsg')->where('user_id', $find['n_user_id'])->cache(true)->find();
|
||||
if ($msg) {
|
||||
$user['no_update'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Common extends BaseController
|
||||
|
||||
public function config()
|
||||
{
|
||||
$config = systemConfig(['open_update_info', 'store_street_theme', 'is_open_service', 'is_phone_login', 'global_theme', 'integral_status', 'mer_location', 'alipay_open', 'hide_mer_status', 'mer_intention_open', 'share_info', 'share_title', 'share_pic', 'store_user_min_recharge', 'recharge_switch', 'balance_func_status', 'yue_pay_status', 'site_logo', 'routine_logo', 'site_name', 'login_logo', 'procudt_increase_status', 'sys_extension_type', 'member_status', 'copy_command_status', 'community_status','community_reply_status','community_app_switch', 'withdraw_type', 'recommend_switch', 'member_interests_status', 'beian_sn', 'community_reply_auth','hot_ranking_switch','svip_switch_status']);
|
||||
$config = systemConfig(['open_update_info', 'store_street_theme', 'is_open_service', 'is_phone_login', 'global_theme', 'integral_status', 'mer_location', 'alipay_open', 'hide_mer_status', 'mer_intention_open', 'share_info', 'share_title', 'share_pic', 'store_user_min_recharge', 'recharge_switch', 'balance_func_status', 'yue_pay_status', 'site_logo', 'routine_logo', 'site_name', 'login_logo', 'procudt_increase_status', 'sys_extension_type', 'member_status', 'copy_command_status', 'community_status','community_reply_status','community_app_switch', 'withdraw_type', 'recommend_switch', 'member_interests_status', 'beian_sn', 'community_reply_auth','hot_ranking_switch','svip_switch_status','margin_ico','margin_ico_switch']);
|
||||
$make = app()->make(TemplateMessageRepository::class);
|
||||
|
||||
$cache = app()->make(CacheRepository::class)->search(['copyright_status', 'copyright_context', 'copyright_image', 'sys_intention_agree']);
|
||||
@ -180,6 +180,9 @@ class Common extends BaseController
|
||||
public function wechatNotify()
|
||||
{
|
||||
try {
|
||||
if($this->request->header('content-type') === 'application/json'){
|
||||
return response(WechatService::create()->handleNotifyV3()->getContent());
|
||||
}
|
||||
return response(WechatService::create()->handleNotify()->getContent());
|
||||
} catch (Exception $e) {
|
||||
Log::info('支付回调失败:' . var_export([$e->getMessage(), $e->getFile() . ':' . $e->getLine()], true));
|
||||
@ -194,7 +197,7 @@ class Common extends BaseController
|
||||
if (!in_array($type, ['order', 'presell'], true))
|
||||
throw new ValidateException('参数错误');
|
||||
try {
|
||||
WechatService::create()->handleCombinePayNotify($type);
|
||||
return WechatService::create()->handleCombinePayNotify($type);
|
||||
} catch (Exception $e) {
|
||||
Log::info('电商收付通支付回调失败:' . var_export([$e->getMessage(), $e->getFile() . ':' . $e->getLine()], true));
|
||||
}
|
||||
@ -208,7 +211,7 @@ class Common extends BaseController
|
||||
if (!in_array($type, ['order', 'presell'], true))
|
||||
throw new ValidateException('参数错误');
|
||||
try {
|
||||
WechatService::create()->handleCombinePayNotify($type);
|
||||
return WechatService::create()->handleCombinePayNotify($type);
|
||||
} catch (Exception $e) {
|
||||
Log::info('小程序电商收付通支付回调失败:' . var_export([$e->getMessage(), $e->getFile() . ':' . $e->getLine()], true));
|
||||
}
|
||||
@ -217,15 +220,18 @@ class Common extends BaseController
|
||||
public function routineNotify()
|
||||
{
|
||||
try {
|
||||
if($this->request->header('content-type') === 'application/json'){
|
||||
return response(MiniProgramService::create()->handleNotifyV3()->getContent());
|
||||
}
|
||||
return response(MiniProgramService::create()->handleNotify()->getContent());
|
||||
} catch (Exception $e) {
|
||||
Log::info('支付回调失败:' . var_export([$e->getMessage(), $e->getFile() . ':' . $e->getLine()], true));
|
||||
Log::info('支付回调失败:' . var_export([$e->getMessage(), $e->getFile() . ':' . $e->getLine(),$this->request->header()], true));
|
||||
}
|
||||
}
|
||||
|
||||
public function alipayNotify($type)
|
||||
{
|
||||
if (!in_array($type, ['order', 'user_recharge', 'presell'], true))
|
||||
if (!in_array($type, ['order', 'user_recharge', 'presell', 'user_order'], true))
|
||||
throw new ValidateException('参数错误');
|
||||
$post = $_POST;
|
||||
$get = $_GET;
|
||||
@ -256,6 +262,7 @@ class Common extends BaseController
|
||||
['image', ''],
|
||||
['code', ''],
|
||||
], true);
|
||||
checkSuffix([$imageUrl, $codeUrl]);
|
||||
try {
|
||||
$codeTmp = $code = $codeUrl ? image_to_base64($codeUrl) : '';
|
||||
if (!$codeTmp) {
|
||||
|
@ -20,6 +20,7 @@ use app\common\repositories\user\UserRelationRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
use app\validate\api\CommunityValidate;
|
||||
use crmeb\basic\BaseController;
|
||||
use crmeb\services\MiniProgramService;
|
||||
use think\App;
|
||||
use app\common\repositories\community\CommunityRepository as repository;
|
||||
use think\exception\ValidateException;
|
||||
@ -66,10 +67,11 @@ class Community extends BaseController
|
||||
$where['is_type'] = $this->repository::COMMUNIT_TYPE_VIDEO;
|
||||
unset($where['category_id']);
|
||||
}
|
||||
$where = array_merge($where, $this->repository::IS_SHOW_WHERE);
|
||||
$where = array_merge($where,$this->repository::IS_SHOW_WHERE);
|
||||
[$page, $limit] = $this->getPage();
|
||||
return app('json')->success($this->repository->getApiList($where, $page, $limit, $this->user));
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 视频列表
|
||||
* @return \think\response\Json
|
||||
@ -100,6 +102,8 @@ class Community extends BaseController
|
||||
];
|
||||
$where['uids'] = $relevanceRepository->getSearch($where_)->column('right_id');
|
||||
[$page, $limit] = $this->getPage();
|
||||
$type = $this->request->param('type');
|
||||
if ($type) $where['is_type'] = $this->repository::COMMUNIT_TYPE_VIDEO;
|
||||
return app('json')->success($this->repository->getApiList($where, $page, $limit, $this->user));
|
||||
}
|
||||
|
||||
@ -143,9 +147,9 @@ class Community extends BaseController
|
||||
}
|
||||
$where['uid'] = $id;
|
||||
}
|
||||
|
||||
$where['community_id'] = $this->request->param('community_id','');
|
||||
$where['is_del'] = 0;
|
||||
$where['community_id'] = $this->request->param('community_id','');
|
||||
|
||||
$data = $this->repository->getApiVideoList($where, $page, $limit, $this->user,$is_start);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
@ -298,6 +302,7 @@ class Community extends BaseController
|
||||
}
|
||||
|
||||
$data['content'] = filter_emoji($data['content']);
|
||||
MiniProgramService::create()->msgSecCheck($this->request->userInfo(), $data['content'],3,0);
|
||||
app()->make(CommunityValidate::class)->check($data);
|
||||
$arr = explode("\n", $data['content']);
|
||||
$title = rtrim(ltrim($arr[0]));
|
||||
@ -417,7 +422,7 @@ class Community extends BaseController
|
||||
|
||||
public function getSpuByOrder($id)
|
||||
{
|
||||
$data = $this->repository->getSpuByOrder($id, $this->request->userInfo()->uid);
|
||||
$data = $this->repository->getSpuByOrder($id,7233);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
@ -425,7 +430,9 @@ class Community extends BaseController
|
||||
{
|
||||
$id = (int)$id;
|
||||
$type = $this->request->param('type');
|
||||
$url = $this->repository->qrcode($id, $type, $this->request->userInfo());
|
||||
if ($this->request->isLogin()) {
|
||||
$url = $this->repository->qrcode($id, $type, $this->request->userInfo());
|
||||
}
|
||||
if (!$url) return app('json')->fail('二维码生成失败');
|
||||
return app('json')->success(compact('url'));
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace app\controller\api\community;
|
||||
use app\common\repositories\community\CommunityRepository;
|
||||
use app\common\repositories\system\RelevanceRepository;
|
||||
use crmeb\basic\BaseController;
|
||||
use crmeb\services\MiniProgramService;
|
||||
use think\App;
|
||||
use app\common\repositories\community\CommunityReplyRepository as repository;
|
||||
use think\exception\ValidateException;
|
||||
@ -75,7 +76,7 @@ class CommunityReply extends BaseController
|
||||
|
||||
$data = $this->request->params(['content']);
|
||||
if (empty($data['content'])) return app('json')->fail('请输入回复内容');
|
||||
|
||||
MiniProgramService::create()->msgSecCheck($this->request->userInfo(), $data['content'],2,0);
|
||||
$data['uid'] = $this->request->userInfo()->uid;
|
||||
$data['community_id'] = $id;
|
||||
|
||||
|
@ -196,7 +196,7 @@ class StoreOrder extends BaseController
|
||||
$method = 'delivery';
|
||||
break;
|
||||
}
|
||||
$repository->runDelivery($id,$merId, $data, $split, $method);
|
||||
$repository->runDelivery($id,$merId, $data, $split, $method, $this->request->serviceInfo()->service_id);
|
||||
return app('json')->success('发货成功');
|
||||
}
|
||||
|
||||
@ -334,7 +334,8 @@ class StoreOrder extends BaseController
|
||||
{
|
||||
$order = $orderRepository->getWhere(['order_id' => $id,'mer_id' => $merId]);
|
||||
if (!$order) return app('json')->fail('数据不存在');
|
||||
$orderRepository->verifyOrder($order->verify_code, $merId, 0);
|
||||
$data = $this->request->params(['verify_code','data']);
|
||||
$orderRepository->verifyOrder($order->verify_code, $merId, $data, $this->request->serviceInfo()->service_id);
|
||||
return app('json')->success('订单核销成功');
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,6 @@ class StoreProduct extends BaseController
|
||||
$data['status'] = $merchant->is_audit ? 0 : 1;
|
||||
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
|
||||
$data['rate'] = 3;
|
||||
// $data['cate_id'] = 1;
|
||||
// $data['mer_cate_id'] = 1;
|
||||
$this->repository->create($data, 0, 1);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class StoreRefundOrder extends BaseController
|
||||
return app('json')->fail('未通过必须填写');
|
||||
$data['status'] = $status;
|
||||
$data['fail_message'] = $fail_message;
|
||||
$this->repository->refuse($id,$data);
|
||||
$this->repository->refuse($id,$data, $this->service_id);
|
||||
}
|
||||
return app('json')->success('审核成功');
|
||||
}
|
||||
|
@ -12,19 +12,10 @@
|
||||
|
||||
namespace app\controller\api\store\merchant;
|
||||
|
||||
use app\common\repositories\store\MerchantTakeRepository;
|
||||
use app\common\repositories\store\product\ProductRepository;
|
||||
use app\common\repositories\system\config\ConfigValueRepository;
|
||||
use app\common\repositories\user\UserMerchantRepository;
|
||||
use app\validate\merchant\MerchantTakeValidate;
|
||||
use app\validate\merchant\MerchantUpdateValidate;
|
||||
use crmeb\jobs\ChangeMerchantStatusJob;
|
||||
use think\App;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\common\repositories\system\merchant\MerchantRepository as repository;
|
||||
use think\facade\Queue;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class Merchant extends BaseController
|
||||
{
|
||||
@ -51,7 +42,7 @@ class Merchant extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['keyword', 'order', 'is_best', 'location', 'category_id', 'type_id','is_trader','street_id']);
|
||||
$where = $this->request->params(['keyword', 'order', 'is_best', 'location', 'category_id', 'type_id','is_trader']);
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit, $this->userInfo));
|
||||
}
|
||||
|
||||
@ -75,9 +66,9 @@ class Merchant extends BaseController
|
||||
|
||||
public function systemDetail()
|
||||
{
|
||||
$config = systemConfig(['site_logo', 'site_name']);
|
||||
$config = systemConfig(['site_logo', 'site_name','login_logo']);
|
||||
return app('json')->success([
|
||||
'mer_avatar' => $config['site_logo'],
|
||||
'mer_avatar' => $config['login_logo'],
|
||||
'mer_name' => $config['site_name'],
|
||||
'mer_id' => 0,
|
||||
]);
|
||||
@ -107,7 +98,7 @@ class Merchant extends BaseController
|
||||
*/
|
||||
public function categoryList($id)
|
||||
{
|
||||
if(!$this->repository->merExists($id))
|
||||
if(!$this->repository->merExists((int)$id))
|
||||
return app('json')->fail('店铺已打烊');
|
||||
return app('json')->success($this->repository->categoryList($id));
|
||||
}
|
||||
@ -128,110 +119,4 @@ class Merchant extends BaseController
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit, $this->userInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MerchantUpdateValidate $validate
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/25
|
||||
*/
|
||||
public function update(MerchantUpdateValidate $validate, MerchantTakeValidate $takeValidate, MerchantTakeRepository $repository)
|
||||
{
|
||||
|
||||
$type = $this->request->param('type',1);
|
||||
$id = $this->request->param('id');
|
||||
if(empty($id)){
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
|
||||
$merchant = Db::name('merchant')->where('mer_id',$id)->find();
|
||||
if ($type == 2) {
|
||||
$data = $this->request->params([
|
||||
'mer_info',
|
||||
'mer_certificate',
|
||||
'service_phone',
|
||||
'mer_avatar',
|
||||
'mer_banner',
|
||||
'mer_state',
|
||||
'mini_banner',
|
||||
'mer_keyword',
|
||||
'mer_address',
|
||||
'long',
|
||||
'lat',
|
||||
['delivery_way',[2]],
|
||||
]);
|
||||
|
||||
// 如果手机号不存在,则使用入驻时的手机号
|
||||
$data['service_phone'] = empty($data['service_phone'])?$merchant['mer_phone']:$data['service_phone'];
|
||||
|
||||
$validate->check($data);
|
||||
$sys_bases_status = systemConfig('sys_bases_status') === '0' ? 0 : 1;
|
||||
if ($sys_bases_status && empty($data['mer_certificate']))
|
||||
return app('json')->fail('店铺资质不可为空');
|
||||
|
||||
app()->make(ConfigValueRepository::class)->setFormData([
|
||||
'mer_certificate' => $data['mer_certificate']
|
||||
], $id);
|
||||
unset($data['mer_certificate']);
|
||||
|
||||
foreach ($data['delivery_way'] as $datum) {
|
||||
if ($datum == 1) {
|
||||
$takeData = $this->request->params(['mer_take_status', 'mer_take_location', 'mer_take_day', 'mer_take_time']);
|
||||
$takeData['mer_take_name'] = $merchant['mer_name'];
|
||||
$takeData['mer_take_address'] = $data['mer_address'];
|
||||
$takeData['mer_take_phone'] = $merchant['mer_phone'];
|
||||
$takeValidate->check($takeData);
|
||||
$repository->set($id, $takeData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$delivery_way = implode(',',$data['delivery_way']);
|
||||
if (count($data['delivery_way']) == 1 && $data['delivery_way'] != $merchant['delivery_way']) {
|
||||
app()->make(ProductRepository::class)->getSearch([])
|
||||
->where('mer_id',$merchant['mer_id'])
|
||||
->update(['delivery_way' => $delivery_way]);
|
||||
}
|
||||
|
||||
$data['delivery_way'] = $delivery_way;
|
||||
|
||||
} else {
|
||||
$data = $this->request->params(['mer_state']);
|
||||
|
||||
if ($merchant['is_margin'] == 1 && $data['mer_state'] == 1)
|
||||
return app('json')->fail('开启店铺前请先支付保证金');
|
||||
|
||||
if ($data['mer_state'] && !$merchant['sub_mchid'] && systemConfig('open_wx_combine'))
|
||||
return app('json')->fail('开启店铺前请先完成微信子商户入驻');
|
||||
}
|
||||
Db::name('merchant')->where('mer_id',$id)->update($data);
|
||||
|
||||
Queue::push(ChangeMerchantStatusJob::class, $id);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/7/21
|
||||
*/
|
||||
public function info(MerchantTakeRepository $repository)
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
if(empty($id)){
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
|
||||
$data = Db::name('merchant')->where('mer_id',$id)->find();
|
||||
// $append = ['merchantCategory', 'merchantType', 'mer_certificate'];
|
||||
// if ($merchant['is_margin'] == -10)
|
||||
// $append[] = 'refundMarginOrder';
|
||||
|
||||
// $data = $merchant->append($append)->hidden(['mark', 'reg_admin_id', 'sort'])->toArray();
|
||||
$delivery = $repository->get($id) + systemConfig(['tx_map_key']);
|
||||
$data = array_merge($data,$delivery);
|
||||
$data['sys_bases_status'] = systemConfig('sys_bases_status') === '0' ? 0 : 1;
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -157,7 +157,8 @@ class StoreOrder extends BaseController
|
||||
$source = $this->request->param('source');
|
||||
$source = !isset($source)?2:$source; // 默认来源为2 普通商品订单
|
||||
$where['uid'] = $this->request->uid();
|
||||
// $where['paid'] = 1;
|
||||
$where['paid'] = 1;
|
||||
$where['is_user'] = 1;
|
||||
$where['source'] = $source;
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit, $source));
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ class Discounts extends BaseController
|
||||
->column('discount_id');
|
||||
$where['discount_id'] = $discount_id;
|
||||
}
|
||||
|
||||
return app('json')->success($this->repository->getApilist($where));
|
||||
$data = $this->repository->getApilist($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,6 @@ class StoreCategory extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data['list'] = $ret;
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ class StoreCoupon extends BaseController
|
||||
{
|
||||
$where = $this->request->params(['type','mer_id', 'product','is_pc',['send_type',0]]);
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where['not_svip'] = 1;
|
||||
$data = $couponRepository->apiList($where, $page, $limit, $this->uid);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class StoreProductPresell extends BaseController
|
||||
public function getAgree()
|
||||
{
|
||||
$make = app()->make(CacheRepository::class);
|
||||
return app('json')->success(['sys_product_presell_agree' => $make->getResult('sys_product_presell_agree')]);
|
||||
return app('json')->success($make->getResult('sys_product_presell_agree'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -314,12 +314,14 @@ class StoreSpu extends BaseController
|
||||
$data = [];
|
||||
foreach ($cateId as $cate_id) {
|
||||
$cate = app()->make(StoreCategoryRepository::class)->get($cate_id);
|
||||
$list = $this->repository->getHotRanking($cate_id);
|
||||
$data[] = [
|
||||
'cate_id' => $cate['store_category_id'] ?? 0,
|
||||
'cate_name' => $cate['cate_name'] ?? '总榜',
|
||||
'list' => $list,
|
||||
];
|
||||
if ($cate) {
|
||||
$list = $this->repository->getHotRanking($cate_id);
|
||||
$data[] = [
|
||||
'cate_id' => $cate['store_category_id'] ?? 0,
|
||||
'cate_name' => $cate['cate_name'] ?? '总榜',
|
||||
'list' => $list,
|
||||
];
|
||||
}
|
||||
}
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
@ -172,6 +172,18 @@ class Service extends BaseController
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function hasService($id){
|
||||
$uid = 0;
|
||||
if ($this->request->isLogin()) {
|
||||
$uid = $this->request->uid();
|
||||
}
|
||||
$data = $this->repository->getChatService($id, $uid);
|
||||
if (!$data) {
|
||||
return app('json')->fail('暂无可用客服');
|
||||
}
|
||||
return app('json')->success(200);
|
||||
}
|
||||
|
||||
public function scanLogin($key)
|
||||
{
|
||||
$serviceId = (int)$this->request->param('service_id');
|
||||
|
@ -104,7 +104,7 @@ class Admin extends BaseController
|
||||
return app('json')->fail('金额不可未负数');
|
||||
if (!$repository->merStatusExists((int)$id, $merId))
|
||||
return app('json')->fail('订单信息或状态错误');
|
||||
$repository->eidt($id, $data);
|
||||
$repository->eidt($id, $data, $this->request->serviceInfo()->service_id);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ class User extends BaseController
|
||||
public function services()
|
||||
{
|
||||
$uid = $this->user->uid;
|
||||
$where = $this->request->params(['is_verify', 'customer', 'is_goods', 'is_open']);
|
||||
$where = $this->request->params(['is_verify', 'customer', 'is_goods', ['is_open',1]]);
|
||||
$is_sys = $this->request->param('is_sys');
|
||||
return app('json')->success(app()->make(StoreServiceRepository::class)->getServices($uid, $where,$is_sys));
|
||||
}
|
||||
@ -685,14 +685,19 @@ class User extends BaseController
|
||||
if (systemConfig('open_update_info') != '1') {
|
||||
return app('json')->fail('不允许修改基本信息');
|
||||
}
|
||||
$data = $this->request->params(['nickname', 'avatar']);
|
||||
if (!$data['nickname'] && !$data['avatar'])
|
||||
$nickname = $this->request->param('nickname');
|
||||
$avatar = $this->request->param('avatar');
|
||||
if (!$nickname && !$avatar)
|
||||
return app('json')->fail('未做任何修改');
|
||||
$user = $this->request->userInfo();
|
||||
$data['nickname'] = $data['nickname'] ?: $user['nickname'] ;
|
||||
$data['avatar'] = $data['avatar'] ?: $user['avatar'] ;
|
||||
$validate->check($data);
|
||||
$user->save($data);
|
||||
if(!empty($nickname)) {
|
||||
$validate->check(['nickname' => $nickname]);
|
||||
$data['nickname'] = $nickname;
|
||||
}
|
||||
if(!empty($avatar)) {
|
||||
$data['avatar'] = $avatar;
|
||||
}
|
||||
$this->repository->updateBaseInfo($data,$user);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
/**
|
||||
|
@ -68,4 +68,12 @@ class UserExtract extends BaseController
|
||||
$data = app()->make(GroupDataRepository::class)->groupData('bank_list',0,$page,100);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function historyBank()
|
||||
{
|
||||
$data = $this->repository->getHistoryBank($this->request->userInfo()->uid);
|
||||
return app('json')->success($data ?? []);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -44,14 +44,13 @@ class UserRelation extends BaseController
|
||||
$params = $this->request->params(['type_id', 'type']);
|
||||
$params['uid'] = $this->request->uid();
|
||||
if (!$params['type_id'])
|
||||
return app('json')->fail('参数丢失');
|
||||
return app('json')->fail('请选择'. ($params['type'] == 1 ? '商品' : '商户'));
|
||||
if (!in_array($params['type'], [0,1,2,3,4,10]))
|
||||
return app('json')->fail('参数错误');
|
||||
if (!$this->repository->fieldExists($params))
|
||||
return app('json')->fail('数据不存在');
|
||||
if ($this->repository->getUserRelation($params,$this->request->uid()))
|
||||
return app('json')->fail('您已经关注过了');
|
||||
$params['uid'] = $this->request->uid();
|
||||
$this->repository->create($params);
|
||||
return app('json')->success('关注成功');
|
||||
}
|
||||
@ -84,13 +83,12 @@ class UserRelation extends BaseController
|
||||
* @author Qinii
|
||||
* @day 7/12/21
|
||||
*/
|
||||
public function lstDelete()
|
||||
public function batchDelete()
|
||||
{
|
||||
$params = $this->request->params(['type_id','type']);
|
||||
$params['uid'] = $this->request->uid();
|
||||
if(!$this->repository->getWhere($params))
|
||||
return app('json')->fail('信息不存在');
|
||||
$this->repository->destory($params,1);
|
||||
$ids = $this->request->param('type_id');
|
||||
$type = $this->request->param('type',1);
|
||||
if(empty($ids)) return app('json')->fail('请选择'. ($type == 1 ? '商品' : '商户'));
|
||||
$this->repository->batchDestory($ids,$this->request->uid(),$type);
|
||||
return app('json')->success('已取消关注');
|
||||
}
|
||||
|
||||
@ -105,7 +103,7 @@ class UserRelation extends BaseController
|
||||
$params = $this->request->params(['type_id','type']);
|
||||
if (!$this->repository->getUserRelation($params,$this->request->uid()))
|
||||
return app('json')->fail('信息不存在');
|
||||
$this->repository->destory($params);
|
||||
$rest = $this->repository->batchDestory([$params['type_id']],$this->request->uid(),$params['type']);
|
||||
return app('json')->success('已取消关注');
|
||||
}
|
||||
|
||||
@ -121,4 +119,5 @@ class UserRelation extends BaseController
|
||||
$this->repository->batchCreate($this->request->uid(),$params);
|
||||
return app('json')->success('收藏成功');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ class Common extends BaseController
|
||||
'fileExt' => 'mp4,mov',
|
||||
'fileMime' => 'video/mp4,video/quicktime',
|
||||
]])->check(['file' => $file]);
|
||||
$upload = UploadService::create(1);
|
||||
$upload = UploadService::create();
|
||||
$data = $upload->to('media')->validate([])->move('file');
|
||||
if ($data === false) {
|
||||
return app('json')->fail($upload->getError());
|
||||
|
@ -53,20 +53,12 @@ class Excel extends BaseController
|
||||
* @author Qinii
|
||||
* @day 2020-07-30
|
||||
*/
|
||||
public function download($id)
|
||||
public function downloadExpress()
|
||||
{
|
||||
try{
|
||||
if($id == 'express'){
|
||||
$file['name'] = 'express';
|
||||
$path = app()->getRootPath().'extend/express.xlsx';
|
||||
if(!$file || !file_exists($path)) return app('json')->fail('文件不存在');
|
||||
return download($path,$file['name']);
|
||||
}
|
||||
|
||||
$file = $this->repository->getWhere(['excel_id' => $id,'mer_id' => $this->request->merId()]);
|
||||
$path = app()->getRootPath().'public'.$file['path'];
|
||||
$file['name'] = 'express';
|
||||
$path = app()->getRootPath().'extend/express.xlsx';
|
||||
if(!$file || !file_exists($path)) return app('json')->fail('文件不存在');
|
||||
|
||||
return download($path,$file['name']);
|
||||
}catch (UploadException $e){
|
||||
return app('json')->fail('下载失败');
|
||||
|
@ -82,7 +82,6 @@ class StoreImport extends BaseController
|
||||
if (!$file) return app('json')->fail('请上传EXCEL文件');
|
||||
$file = is_array($file) ? $file[0] : $file;
|
||||
validate(["file|文件" => ['fileExt' => 'xlsx,xls',]])->check(['file' => $file]);
|
||||
|
||||
$upload = UploadService::create(1);
|
||||
$ret = $upload->to('excel')->move('file');
|
||||
if ($ret === false) return app('json')->fail($upload->getError());
|
||||
@ -90,7 +89,31 @@ class StoreImport extends BaseController
|
||||
$path = rtrim(public_path(),'/').$res['dir'];
|
||||
$data = [];
|
||||
switch ($type){
|
||||
case 'delivery' :
|
||||
case 'delivery':
|
||||
$check =[
|
||||
'A1'=>'商品名称',
|
||||
'B1'=>'商品简介',
|
||||
'C1'=>'关键字',
|
||||
'D1'=>'商品条码',
|
||||
'E1'=>'分类',
|
||||
'F1'=>'单位名',
|
||||
'G1'=>'出售价',
|
||||
'H1'=>'成本价',
|
||||
'I1'=>'总库存',
|
||||
];
|
||||
SpreadsheetExcelService::instance()->checkImport($path,$check);
|
||||
$data = [
|
||||
'mer_id' => $this->request->merId(),
|
||||
'data' => [
|
||||
'path' => $path,
|
||||
'sql' => ['store_name' => 'A', 'store_info' => 'B', 'keyword' => 'C', 'bar_code' => 'D', 'cate_id' => 'E', 'unit_name' => 'F', 'price' => 'G', 'cost' => 'H', 'stock' => 'I'],
|
||||
'where' => ['bar_code' => 'D'],
|
||||
]
|
||||
];
|
||||
app()->make(StoreOrderRepository::class)->setProduct($data['data'],$data['mer_id']);
|
||||
|
||||
break;
|
||||
case 'product' :
|
||||
SpreadsheetExcelService::instance()->checkImport($path,['E3' => '物流单号']);
|
||||
$data = [
|
||||
'mer_id' => $this->request->merId(),
|
||||
|
@ -124,6 +124,7 @@ class DeliveryStation extends BaseController
|
||||
$make->scene('dada')->check($data);
|
||||
} else {
|
||||
$make->check($data);
|
||||
[$data['lng'],$data['lat']] = gcj02ToBd09($data['lng'],$data['lat']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@ -181,7 +182,7 @@ class DeliveryStation extends BaseController
|
||||
public function getQrcode()
|
||||
{
|
||||
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
|
||||
$data['pay_type'] = 1;
|
||||
$data['pay_type'] = $this->request->param('pay_type',1);
|
||||
$data['price'] = $this->request->param('price',10);
|
||||
if (!is_numeric($data['price']) || $data['price'] <= 0 )
|
||||
return app('json')->fail('支付金额不正确');
|
||||
|
@ -236,7 +236,6 @@ class Order extends BaseController
|
||||
];
|
||||
if ($params['delivery_type'] == 4 && !systemConfig('crmeb_serve_dump'))
|
||||
return app('json')->fail('电子面单功能未开启');
|
||||
$this->repository->batchDelivery($data['mer_id'],$data['data']);
|
||||
Queue::push(BatchDeliveryJob::class, $data);
|
||||
return app('json')->success('开始批量发货');
|
||||
}
|
||||
@ -295,9 +294,11 @@ class Order extends BaseController
|
||||
public function status($id)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['date','user_type']);
|
||||
$where['id'] = $id;
|
||||
if (!$this->repository->getOne($id, $this->request->merId()))
|
||||
return app('json')->fail('数据不存在');
|
||||
return app('json')->success($this->repository->getOrderStatus($id, $page, $limit));
|
||||
return app('json')->success($this->repository->getOrderStatus($where, $page, $limit));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -447,6 +448,11 @@ class Order extends BaseController
|
||||
[$page, $limit] = $this->getPage();
|
||||
$data = app()->make(ExcelService::class)->delivery($where,$page,$limit);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function childrenList($id)
|
||||
{
|
||||
$data = $this->repository->childrenList($id, $this->request->merId());
|
||||
return app('json')->success($data);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ namespace app\controller\merchant\store\order;
|
||||
|
||||
use app\common\repositories\store\ExcelRepository;
|
||||
use app\common\repositories\store\order\MerchantReconciliationRepository;
|
||||
use app\common\repositories\store\order\StoreOrderStatusRepository;
|
||||
use app\common\repositories\store\order\StoreRefundStatusRepository;
|
||||
use crmeb\services\ExcelService;
|
||||
use think\App;
|
||||
@ -82,7 +83,7 @@ class RefundOrder extends BaseController
|
||||
if ($data['phone'] && isPhone($data['phone']))
|
||||
return app('json')->fail('请输入正确的手机号');
|
||||
$data['status'] = $status;
|
||||
$this->repository->agree($id,$data,$this->request->adminId());
|
||||
$this->repository->agree($id,$data);
|
||||
}else{
|
||||
$fail_message = $this->request->param('fail_message','');
|
||||
if($status == -1 && empty($fail_message))
|
||||
@ -105,7 +106,7 @@ class RefundOrder extends BaseController
|
||||
{
|
||||
if(!$this->repository->getRefundPriceExists($this->request->merId(),$id))
|
||||
return app('json')->fail('信息或状态错误');
|
||||
$this->repository->adminRefund($id,$this->request->adminId());
|
||||
$this->repository->adminRefund($id,0);
|
||||
return app('json')->success('退款成功');
|
||||
}
|
||||
|
||||
@ -171,8 +172,11 @@ class RefundOrder extends BaseController
|
||||
public function log($id)
|
||||
{
|
||||
list($page,$limit) = $this->getPage();
|
||||
$make = app()->make(StoreRefundStatusRepository::class);
|
||||
return app('json')->success($make->search($id,$page,$limit));
|
||||
$where = $this->request->params(['date','user_type']);
|
||||
$where['id'] = $id;
|
||||
$where['type'] = StoreOrderStatusRepository::TYPE_REFUND;
|
||||
$data = app()->make(StoreOrderStatusRepository::class)->search($where,$page,$limit);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function reList($id)
|
||||
|
@ -120,9 +120,9 @@ class Discounts extends BaseController
|
||||
}
|
||||
foreach ($data['products'] as $item) {
|
||||
if (!isset($item['items']))
|
||||
return app('json')->fail('请选择' . $item['store_name'] . '的规格');
|
||||
throw new ValidateException('请选择' . $item['store_name'] . '的规格');
|
||||
foreach ($item['attr'] as $attr) {
|
||||
if($attr['active_price'] > $attr['price']) return app('json')->fail('套餐价格高于原价');
|
||||
if($attr['active_price'] > $attr['price']) throw new ValidateException('套餐价格高于原价');
|
||||
}
|
||||
}
|
||||
$data['mer_id'] = $this->request->merId();
|
||||
|
@ -47,7 +47,7 @@ class Product extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['temp_id','cate_id','keyword',['type',1],'mer_cate_id','is_gift_bag','status','us_status','product_id','mer_labels',['order','sort'],'is_ficti']);
|
||||
$where = $this->request->params(['temp_id','cate_id','keyword',['type',1],'mer_cate_id','is_gift_bag','status','us_status','product_id','mer_labels',['order','sort'],'is_ficti','svip_price_type']);
|
||||
$where = array_merge($where,$this->repository->switchType($where['type'],$this->request->merId(),0));
|
||||
return app('json')->success($this->repository->getList($this->request->merId(),$where, $page, $limit));
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user