commit
82baff3003
@ -85,16 +85,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($merchantCart['list'] as $cart) {
|
foreach ($merchantCart['list'] as $cart) {
|
||||||
$canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']);
|
|
||||||
if (!$canBuy) {
|
|
||||||
throw new ValidateException('活动商品限购1个');
|
|
||||||
}
|
|
||||||
if ($canBuy == 2) {
|
|
||||||
$activityProductCount += $cart['cart_num'];
|
|
||||||
if ($activityProductCount > 1){
|
|
||||||
throw new ValidateException('活动商品限购1个');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($cart['product_type'] == 0) {
|
if ($cart['product_type'] == 0) {
|
||||||
if ($cart['product']['once_min_count'] > 0 && $cart['product']['once_min_count'] > $cart['cart_num'])
|
if ($cart['product']['once_min_count'] > 0 && $cart['product']['once_min_count'] > $cart['cart_num'])
|
||||||
throw new ValidateException('[低于起购数:' . $cart['product']['once_min_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
throw new ValidateException('[低于起购数:' . $cart['product']['once_min_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||||
@ -112,6 +102,18 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$order_type = $cart['product_type'];
|
$order_type = $cart['product_type'];
|
||||||
}
|
}
|
||||||
$source = $cart['source'];
|
$source = $cart['source'];
|
||||||
|
if($source==103){
|
||||||
|
$canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']);
|
||||||
|
if (!$canBuy) {
|
||||||
|
throw new ValidateException('活动商品限购1个');
|
||||||
|
}
|
||||||
|
if ($canBuy == 2) {
|
||||||
|
$activityProductCount += $cart['cart_num'];
|
||||||
|
if ($activityProductCount > 1){
|
||||||
|
throw new ValidateException('活动商品限购1个');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
||||||
throw new ValidateException('活动商品必须单独购买');
|
throw new ValidateException('活动商品必须单独购买');
|
||||||
}
|
}
|
||||||
|
@ -306,6 +306,7 @@ class StoreProduct extends BaseController
|
|||||||
public function copy($product_id = 0, $mer_id = 0, $street_code = 0, $type_id = 0, $category_id = 0)
|
public function copy($product_id = 0, $mer_id = 0, $street_code = 0, $type_id = 0, $category_id = 0)
|
||||||
{
|
{
|
||||||
if ($product_id == 0) return app('json')->fail('参数错误');
|
if ($product_id == 0) return app('json')->fail('参数错误');
|
||||||
|
$find= Db::name('merchant')->where('mer_id',$mer_id)->find();
|
||||||
$products = $this->repository->getAdminOneProduct($product_id, 0);
|
$products = $this->repository->getAdminOneProduct($product_id, 0);
|
||||||
$product = $products->toArray();
|
$product = $products->toArray();
|
||||||
$product['mer_id'] = $mer_id;
|
$product['mer_id'] = $mer_id;
|
||||||
@ -321,7 +322,12 @@ class StoreProduct extends BaseController
|
|||||||
'create_time' => date('Y-m-d H:i:s'),
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
'type_id' => $type_id,
|
'type_id' => $type_id,
|
||||||
'category_id' => $category_id,
|
'category_id' => $category_id,
|
||||||
'cate_id' => $product['cate_id']
|
'cate_id' => 2244,
|
||||||
|
'long' => $find['long'],
|
||||||
|
'lat' => $find['lat'],
|
||||||
|
'lat' => $find['lat'],
|
||||||
|
'store_name' => $products['store_name'],
|
||||||
|
'activity_id' =>2,
|
||||||
];
|
];
|
||||||
Db::name('cloud_product')->insert($data);
|
Db::name('cloud_product')->insert($data);
|
||||||
return $productId;
|
return $productId;
|
||||||
|
@ -21,6 +21,7 @@ use Exception;
|
|||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
use think\facade\Queue;
|
use think\facade\Queue;
|
||||||
use crmeb\jobs\ProductCopyJob;
|
use crmeb\jobs\ProductCopyJob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Auth
|
* Class Auth
|
||||||
* @package app\controller\api
|
* @package app\controller\api
|
||||||
@ -30,18 +31,95 @@ use crmeb\jobs\ProductCopyJob;
|
|||||||
class Demo extends BaseController
|
class Demo extends BaseController
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return app('json')->success('修改成功');
|
return app('json')->success('修改成功');
|
||||||
//[31,32,118,39,167,236,237,238,239]
|
//[31,32,118,39,167,236,237,238,239]
|
||||||
// return app('json')->success('修改成功');>whereIn('mer_id',[110,116,149,227,226,35,117,148,156,104,137,151,136,183,140,229,79,133,235])->
|
// return app('json')->success('修改成功');>whereIn('mer_id',[110,116,149,227,226,35,117,148,156,104,137,151,136,183,140,229,79,133,235])->
|
||||||
|
// $merchant = Db::name('merchant')->where('mer_id', 31)->find();
|
||||||
|
// $arr = Db::name('cloud_product')->where('mer_id', $merchant['mer_id'])->select();
|
||||||
|
// $arr=Db::name('store_product')->whereIn('mer_id',[31,32,118,39,167,236,237,238,239])->where('is_show',1)->where('stock',0)->field('product_id')->select();
|
||||||
|
// foreach ($arr as $item) {
|
||||||
|
|
||||||
$arr=Db::name('store_product')->whereIn('mer_id',[31,32,118,39,167,236,237,238,239])->where('is_show',1)->where('stock',0)->field('product_id')->select();
|
// $store_name = Db::name('store_product')->where('product_id', $item['product_id'])->value('store_name');
|
||||||
foreach($arr as $item){
|
// if ($store_name) {
|
||||||
|
// Db::name('cloud_product')->where('mer_id', $merchant['mer_id'])->where(
|
||||||
Queue::push(ProductCopyJob::class, ['product_id' => $item['product_id']]);//短信通知
|
// 'product_id',
|
||||||
|
// $item['product_id']
|
||||||
|
// )->update(['store_name' => $store_name,'long'=>$merchant['long'],'lat'=>$merchant['lat']]);
|
||||||
|
// }
|
||||||
|
// // Queue::push(ProductCopyJob::class, ['product_id' => $item['product_id']]);//短信通知
|
||||||
|
|
||||||
|
// }
|
||||||
|
$arr=[
|
||||||
|
['product_id'=>171650,],
|
||||||
|
['product_id'=>171649,],
|
||||||
|
['product_id'=>171648,],
|
||||||
|
['product_id'=>171647],
|
||||||
|
];
|
||||||
|
$mer_id=167;//导入到的商户
|
||||||
|
$street_code=510521107;//导入到的商户
|
||||||
|
$type_id=17;//导入到的商户分类
|
||||||
|
$category_id=2566;//导入到的商户分类
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$mer_id=236;//导入到的商户
|
||||||
|
$street_code=510521123;//导入到的商户
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
$mer_id=237;//导入到的商户
|
||||||
|
$street_code=510521115;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
$mer_id=238;//导入到的商户
|
||||||
|
$street_code=510521105;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
$mer_id=239;//导入到的商户
|
||||||
|
$street_code=510521116;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
//江阳
|
||||||
|
$mer_id=31;//导入到的商户
|
||||||
|
$street_code=510502108;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
$mer_id=32;//导入到的商户
|
||||||
|
$street_code=510502107;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
$mer_id=118;//导入到的商户
|
||||||
|
$street_code=510502106;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
|
}
|
||||||
|
|
||||||
|
$mer_id=39;//导入到的商户
|
||||||
|
$street_code=510502105;//导入到的商户
|
||||||
|
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transcoding($fileName)
|
public function transcoding($fileName)
|
||||||
@ -55,26 +133,26 @@ class Demo extends BaseController
|
|||||||
return $fileName;
|
return $fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDirectories($path) {
|
function createDirectories($path)
|
||||||
|
{
|
||||||
if (is_dir($path)) {
|
if (is_dir($path)) {
|
||||||
return true ;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$parts = explode(DIRECTORY_SEPARATOR, $path);
|
$parts = explode(DIRECTORY_SEPARATOR, $path);
|
||||||
$part = null;
|
$part = null;
|
||||||
|
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
if ($part === '' || $part === '.' || $part === '..') {
|
if ($part === '' || $part === '.' || $part === '..') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = dirname($path) . DIRECTORY_SEPARATOR . $part;
|
$dir = dirname($path) . DIRECTORY_SEPARATOR . $part;
|
||||||
if (!file_exists($dir)) {
|
if (!file_exists($dir)) {
|
||||||
mkdir($dir, 0777, true);
|
mkdir($dir, 0777, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ class CloudWarehouse extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '')
|
public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '')
|
||||||
{
|
{
|
||||||
|
$keyword = $this->request->get('keyword');
|
||||||
if (!empty($location) && $location != ',') {
|
if (!empty($location) && $location != ',') {
|
||||||
[$lat, $lng] = explode(',', $location);
|
[$lat, $lng] = explode(',', $location);
|
||||||
} elseif (!empty($street_code)) {
|
} elseif (!empty($street_code)) {
|
||||||
@ -69,6 +70,9 @@ class CloudWarehouse extends BaseController
|
|||||||
if($cate_id>0){
|
if($cate_id>0){
|
||||||
$query->whereIn('cate_id', $cate_id);
|
$query->whereIn('cate_id', $cate_id);
|
||||||
}
|
}
|
||||||
|
if (!empty($keyword)) {
|
||||||
|
$query->where('store_name', 'like', '%'. $keyword . '%');
|
||||||
|
}
|
||||||
$cloud_product_arr = $query->where(function($query){
|
$cloud_product_arr = $query->where(function($query){
|
||||||
$query->where('mer_labels', '')
|
$query->where('mer_labels', '')
|
||||||
->whereOr('mer_labels',',5,');
|
->whereOr('mer_labels',',5,');
|
||||||
|
@ -34,8 +34,8 @@ class ProductCopyJob implements JobInterface
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// $make = app()->make(StoreProduct::class);
|
$make = app()->make(StoreProduct::class);
|
||||||
// $make->copy($data['product_id'],$data['mer_id'],$data['street_code'],$data['type_id'],$data['category_id']);
|
$make->copy($data['product_id'],$data['mer_id'],$data['street_code'],$data['type_id'],$data['category_id']);
|
||||||
$job->delete();
|
$job->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user