This commit is contained in:
mkm 2024-05-17 16:18:21 +08:00
parent 1325187237
commit 13ed85b336
5 changed files with 72 additions and 27 deletions

View File

@ -10,6 +10,7 @@ use app\admin\logic\operation\OpurchaseclassLogic;
use app\admin\validate\operation\OpurchaseclassValidate;
use app\common\logic\PayNotifyLogic;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsLabel;
use app\common\model\opurchase\OpurchaseGoodsOffer;
use app\common\model\opurchase\Opurchaseinfo;
use app\common\model\supplier\Supplier;
@ -76,8 +77,9 @@ class OpurchaseclassController extends BaseAdminController
public function sub_orders()
{
$id = $this->request->get('id');
$is_mer = $this->request->get('is_mer',1);
$page_no = $this->request->get('page_no', 1);
$result = OpurchaseclassLogic::sub_detail($id, $page_no);
$result = OpurchaseclassLogic::sub_detail($id,$is_mer, $page_no);
return $this->data($result);
}
@ -88,20 +90,29 @@ class OpurchaseclassController extends BaseAdminController
{
$id = $this->request->get('id');
$page_no = $this->request->get('page_no', 1);
$page_size = $this->request->get('page_size', 15);
$is_push = $this->request->get('is_push');
$where['pid']=$id;
if($is_push){
$where['is_push'] = $is_push;
}
$res = Opurchaseinfo::where($where)->page($page_no, 25)->select()->each(function ($item) {
$res = Opurchaseinfo::where($where)->page($page_no, $page_size)->select()->each(function ($item) {
$item['sys_labels_arr']='';
$find = Goods::where('id', $item['goods'])->with('unitName')->find();
$item['goods_name'] = $find['name'];
$item['unit_name'] = $find['unit_name'];
if($find){
$item['goods_name'] = $find['name'];
$item['unit_name'] = $find['unit_name'];
$goodslabel = GoodsLabel::where('id','in',$item['sys_labels'])->column('id,name');
if($goodslabel){
$item['sys_labels_arr'] = implode(',',$goodslabel);
}
}
});
$data['count'] = Opurchaseinfo::where('pid', $id)->count();
$data['lists'] = $res?->toArray();
$data['page_no'] = $page_no;
$data['page_siz'] = 15;
$data['page_siz'] = $page_size;
return $this->success('ok', $data);
}

View File

@ -7,6 +7,7 @@ use app\admin\lists\BaseAdminDataLists;
use app\common\model\operation\Opurchaseclass;
use app\common\lists\ListsSearchInterface;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsLabel;
use app\common\model\opurchase\OpurchaseGoodsOffer;
use app\common\model\supplier\Supplier;
@ -51,8 +52,10 @@ class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearch
->order(['id' => 'desc'])
->select()->each(function ($item) {
$find = Goods::where('id', $item['goods_id'])->with('unitName')->find();
$item['goods_name'] = $find['name'];
$item['unit_name'] = $find['unit_name'];
if($find){
$item['goods_name'] = $find['name'];
$item['unit_name'] = $find['unit_name'];
}
$item['supplier_name'] = Supplier::where('id',$item['supplier_id'])->value('mer_name');
})->toArray();
}

View File

@ -147,24 +147,44 @@ class OpurchaseclassLogic extends BaseLogic
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function sub_detail($id, $page_no): array
public static function sub_detail($id,$is_mer, $page_no): array
{
$order_arr = Opurchaseclass::where('id', $id)->value('order_arr');
$data = [];
if ($order_arr) {
$order_arr = explode(',', $order_arr);
$order_arr_count = count($order_arr);
$offset = ($page_no - 1) * $order_arr_count;
$paged_items = array_slice($order_arr, $offset, $order_arr_count);
if (!$paged_items) {
return [];
if($is_mer==1){
$order_arr = Opurchaseclass::where('id', $id)->value('order_arr');
$data = [];
if ($order_arr) {
$order_arr = explode(',', $order_arr);
$order_arr_count = count($order_arr);
$offset = ($page_no - 1) * $order_arr_count;
$paged_items = array_slice($order_arr, $offset, $order_arr_count);
if (!$paged_items) {
return [];
}
$list = Cashierclass::whereIn('id', $order_arr)->select()?->toArray();
$data['count'] = $order_arr_count;
$data['lists'] = $list;
$data['page_no'] = $page_no;
$data['page_siz'] = 15;
}
}else{
$order_arr = Opurchaseclass::where('id', $id)->where('is_mer', $is_mer)->value('order_arr');
$data = [];
if ($order_arr) {
$order_arr = explode(',', $order_arr);
$order_arr_count = count($order_arr);
$offset = ($page_no - 1) * $order_arr_count;
$paged_items = array_slice($order_arr, $offset, $order_arr_count);
if (!$paged_items) {
return [];
}
$list = Opurchaseclass::whereIn('id', $order_arr)->select()?->toArray();
$data['count'] = $order_arr_count;
$data['lists'] = $list;
$data['page_no'] = $page_no;
$data['page_siz'] = 15;
}
$list = Cashierclass::whereIn('id', $order_arr)->select()?->toArray();
$data['count'] = $order_arr_count;
$data['lists'] = $list;
$data['page_no'] = $page_no;
$data['page_siz'] = 15;
}
return $data;
}
/**

View File

@ -10,6 +10,7 @@ use app\common\service\PushService;
use app\common\service\wechat\WeChatMnpService;
use app\common\service\wechat\WeChatOaService;
use DateTime;
use think\facade\Db;
use Webman\Config;
use Webman\RedisQueue\Redis;
use Yansongda\Pay\Pay;
@ -17,10 +18,12 @@ use Webman\Push\Api;
class IndexController extends BaseApiController
{
public $notNeedLogin = ['index'];
public $notNeedLogin = ['index','app_update'];
public function index()
{
var_dump(2323);
return json(['msg' =>create_password(123456, '11d3')]);
// PushService::push('store_merchant_502', 502, '支付超时,订单已被取消,请重新提交订单');
// d(1);
// $extra=$this->request->post();
@ -50,4 +53,12 @@ class IndexController extends BaseApiController
}
return response()->download($result, 'webman-curd.zip');
}
/**
* @notes 获取app更新信息
*/
public function app_update(){
$find= Db::name('app_update')->where('type',2)->order('id','desc')->findOrEmpty();
return $this->success('ok',$find);
}
}

View File

@ -148,10 +148,10 @@ class OrderLogic extends BaseLogic
self::setError('没有购物车信息');
return false;
}
if (empty($v['address_id'])) {
self::setError('请先设置配送地址');
return false;
}
// if (empty($v['address_id'])) {
// self::setError('请先设置配送地址');
// return false;
// }
$arr = explode(',',$v['cart_id']);
foreach ($arr as $kk => $vv) {
$cart_arr[] = $vv;