commit
b3898772af
@ -239,7 +239,14 @@ class ProductRepository extends BaseRepository
|
||||
$result = $this->dao->create($product);
|
||||
|
||||
$settleParams = $this->setAttrValue($data, $result->product_id, $productType, 0, $data['mer_id']);
|
||||
if (isset($data['mer_cate_id']) && count($data['mer_cate_id']) != 0) {
|
||||
if (isset($data['mer_cate_id']) && $data['mer_cate_id'] != '') {
|
||||
if (is_array($data['mer_cate_id'])) {
|
||||
if (count($data['mer_cate_id']) == 0) {
|
||||
$data['mer_cate_id'] = [];
|
||||
} elseif ($data['mer_cate_id'][0] == 0) {
|
||||
$data['mer_cate_id'] = [];
|
||||
}
|
||||
}
|
||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $result->product_id, $data['mer_id']);
|
||||
}
|
||||
$settleParams['attr'] = $this->setAttr($data['attr'], $result->product_id);
|
||||
@ -277,10 +284,15 @@ class ProductRepository extends BaseRepository
|
||||
event('product.update.before', compact('id', 'data', 'merId', 'productType', 'conType'));
|
||||
$spuData = $product = $this->setProduct($data);
|
||||
$settleParams = $this->setAttrValue($data, $id, $productType, 1, $merId);
|
||||
if (isset($data['mer_cate_id']) && count($data['mer_cate_id']) != 0 ) {
|
||||
if($data['mer_cate_id'][0]!=0){
|
||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
||||
if (isset($data['mer_cate_id'])) {
|
||||
if (is_array($data['mer_cate_id'])) {
|
||||
if (count($data['mer_cate_id']) == 0) {
|
||||
$data['mer_cate_id'] = [];
|
||||
} elseif ($data['mer_cate_id'][0] == 0) {
|
||||
$data['mer_cate_id'] = [];
|
||||
}
|
||||
}
|
||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
||||
}
|
||||
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
||||
$content = [
|
||||
|
@ -7,6 +7,7 @@ use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use crmeb\services\UploadService;
|
||||
use think\api\Client;
|
||||
use GuzzleHttp\Client as http_client;
|
||||
|
||||
class ProductLibrary extends BaseController
|
||||
{
|
||||
@ -129,9 +130,8 @@ class ProductLibrary extends BaseController
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
$data['images'] = '';
|
||||
$arr=[];
|
||||
|
||||
if ($param['img'] != '') {
|
||||
$oss = $upload->to($dir)->stream(file_get_contents($param['img']));
|
||||
$oss = $upload->to($dir)->stream($this->getPic($param['img']));
|
||||
$data['image'] = $oss->filePath;
|
||||
$arr[]=$oss->filePath;
|
||||
} else {
|
||||
@ -139,7 +139,7 @@ class ProductLibrary extends BaseController
|
||||
$data['slider_image'] = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png';
|
||||
}
|
||||
foreach($param['imgList'] as $k=>$v){
|
||||
$oss=$upload->to($dir)->stream(file_get_contents($v));
|
||||
$oss=$upload->to($dir)->stream($this->getPic($v));
|
||||
$arr[] = $oss->filePath;
|
||||
}
|
||||
if(count($arr)>0){
|
||||
@ -173,4 +173,10 @@ class ProductLibrary extends BaseController
|
||||
throw new \think\exception\ValidateException('一维码商品采集错误:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getPic($url){
|
||||
$client = new http_client();
|
||||
$a=$client->get($url);
|
||||
return $a->getBody()->getContents();
|
||||
}
|
||||
}
|
||||
|
33
app/controller/api/dataview/Logistics.php
Normal file → Executable file
33
app/controller/api/dataview/Logistics.php
Normal file → Executable file
@ -83,4 +83,37 @@ class Logistics extends BaseController
|
||||
$detail['status'] = app()->make(Order::class)->getStatusDesc($detail['status']);
|
||||
return app('json')->success($detail);
|
||||
}
|
||||
|
||||
// 第二页 物流信息统计
|
||||
public function logisticsCount()
|
||||
{
|
||||
// 查询镇辖区内配送订单最多的配送员
|
||||
|
||||
// 先从供销系统 查出镇下边的所有配送员-小组服务公司的负责人
|
||||
$serviceGroupCompanyIds = Db::connect('work_task')->name('company')
|
||||
->where(['street'=> $this->streetCode, 'company_type'=>18])
|
||||
->column('id');
|
||||
$userIdList = Db::connect('work_task')->name('user')
|
||||
->whereIn('company_id', $serviceGroupCompanyIds)
|
||||
->where(['group_id'=>5])
|
||||
->column('id');
|
||||
|
||||
// 从物流系统 查物流订单排序 确定谁是 镇辖区内配送订单最多的配送员
|
||||
$topCourier = Db::connect('logistics')->name('logistics')
|
||||
->field(['courier_id','courier_name','COUNT(order_id) AS order_count'])
|
||||
->whereIn('courier_id', $userIdList)
|
||||
->group('courier_id')
|
||||
->order('order_count DESC')
|
||||
->find();
|
||||
// 返查配送员的物流配送订单统计信息
|
||||
// 待取货数
|
||||
$topCourier['pending_order_count'] = Db::connect('logistics')->name('logistics')->where(['status'=>0, 'courier_id'=>$topCourier['courier_id']])->count();
|
||||
// 配送中数
|
||||
$topCourier['delivering_order_count'] = Db::connect('logistics')->name('logistics')->where(['status'=>1, 'courier_id'=>$topCourier['courier_id']])->count();
|
||||
// 已完成数
|
||||
$topCourier['finished_order_count'] = Db::connect('logistics')->name('logistics')->where([['status', 'in', [2,3]], 'courier_id'=>$topCourier['courier_id']])->count();
|
||||
|
||||
return app('json')->success($topCourier);
|
||||
|
||||
}
|
||||
}
|
16
app/controller/api/dataview/Order.php
Normal file → Executable file
16
app/controller/api/dataview/Order.php
Normal file → Executable file
@ -169,6 +169,7 @@ class Order extends BaseController
|
||||
return $desc[$status];
|
||||
}
|
||||
|
||||
// 配送商品排行榜
|
||||
public function deliveredProductRanking()
|
||||
{
|
||||
// 查到镇级
|
||||
@ -198,4 +199,19 @@ class Order extends BaseController
|
||||
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
// 首页 镇地图统计信息
|
||||
public function townMapCount()
|
||||
{
|
||||
$townList = Db::connect('work_task')->name('geo_street')->field('street_name, street_code, lng, lat')->where('area_code', $this->areaCode)->select()->toArray();
|
||||
foreach ($townList as &$town) {
|
||||
// 店铺数
|
||||
$town['mer_count'] = Db::name('merchant')->where('street_id', $town['street_code'])->count();
|
||||
// 小组服务团队数
|
||||
$town['service_group_count'] = Db::connect('work_task')->name('company')->where(['street'=> $town['street_code'], 'company_type'=>18])->count();
|
||||
}
|
||||
unset($town);
|
||||
|
||||
return app('json')->success(compact('townList'));
|
||||
}
|
||||
}
|
0
app/controller/api/store/merchant/Merchant.php
Normal file → Executable file
0
app/controller/api/store/merchant/Merchant.php
Normal file → Executable file
@ -5,6 +5,7 @@ use crmeb\basic\BaseController;
|
||||
use think\App;
|
||||
use think\facade\Db;
|
||||
use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use Overtrue\Pinyin\Pinyin;
|
||||
|
||||
/**
|
||||
* Class Auth
|
||||
@ -29,6 +30,25 @@ class Merchant extends BaseController
|
||||
return app('json')->success($select);
|
||||
}
|
||||
|
||||
public function get_street(){
|
||||
$area_code = $this->request->param('area_code', '');
|
||||
$select=Db::name('geo_street')->where('area_code',$area_code)->field('street_id id,street_code code,street_name name')->select();
|
||||
$arr=$select?$select->toArray():[];
|
||||
foreach ($arr as $k=>$item){
|
||||
$first_char = mb_str_split($item['name']);
|
||||
if($first_char[0]){
|
||||
$pinyin=new Pinyin();
|
||||
$string=$first_char[0];
|
||||
$pinyin = $pinyin->abbr($string);
|
||||
$arr[$k]['pinyin']=$pinyin;
|
||||
}else{
|
||||
$arr[$k]['pinyin']='';
|
||||
}
|
||||
|
||||
}
|
||||
return app('json')->success($arr);
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
$where = $this->request->params(['keyword', 'date', 'status', 'statusTag', 'is_trader', 'category_id', 'type_id']);
|
||||
|
@ -720,8 +720,11 @@ Route::group('api/', function () {
|
||||
Route::get('curr_order_info', 'Order/currOrderInfo');
|
||||
Route::get('order_ranking', 'Order/orderRanking');
|
||||
Route::get('delivered_product_ranking', 'Order/deliveredProductRanking');
|
||||
Route::get('town_map_count', 'Order/townMapCount');
|
||||
Route::get('vehicle_list', 'Logistics/vehicleList');
|
||||
Route::get('latest_logistics', 'Logistics/latestLogistics');
|
||||
Route::get('logistics_count', 'Logistics/logisticsCount');
|
||||
|
||||
|
||||
})->prefix('api.dataview.');
|
||||
})->middleware(AllowOriginMiddleware::class)
|
||||
|
@ -25,6 +25,7 @@ Route::group('middle/', function () {
|
||||
Route::any('user/lst', 'middle.User/lst');
|
||||
|
||||
Route::any('merchant/city/get_area', 'middle.Merchant/get_area');
|
||||
Route::any('merchant/city/get_street', 'middle.Merchant/get_street');
|
||||
Route::any('merchant/count', 'middle.Merchant/count');
|
||||
Route::any('merchant/category/options', 'middle.MerchantCategory/getOptions');
|
||||
Route::any('merchant/type/options', 'middle.MerchantType/options');
|
||||
|
Loading…
x
Reference in New Issue
Block a user