更新
This commit is contained in:
parent
a4d178a0d6
commit
d87470bc95
@ -51,10 +51,10 @@ class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($data){
|
->select()->each(function($data){
|
||||||
if(!empty($data['sys_labels'])){
|
if(!empty($data['sys_labels'])){
|
||||||
$goodslabel = GoodsLabel::where('id','in',trim($data['sys_labels'],','))->column('name');
|
$goodslabel = GoodsLabel::where('id','in',$data['sys_labels'])->column('id,name');
|
||||||
$data['sys_labels_text'] = implode(',',$goodslabel);
|
$data['sys_labels_arr'] = $goodslabel;
|
||||||
}else{
|
}else{
|
||||||
$data['sys_labels_text'] = '';
|
$data['sys_labels_arr'] = [];
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -48,12 +48,12 @@ class SupplierLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($data){
|
->select()->each(function($data){
|
||||||
if(!empty($data['sys_labels'])){
|
if(!empty($data['sys_labels'])){
|
||||||
$goodslabel = GoodsLabel::where('id','in',trim($data['sys_labels'],','))->column('name');
|
$goodslabel = GoodsLabel::where('id','in',$data['sys_labels'])->column('id,name');
|
||||||
$data['sys_labels_text'] = implode(',',$goodslabel);
|
$data['sys_labels_arr'] = $goodslabel;
|
||||||
}else{
|
}else{
|
||||||
$data['sys_labels_text'] = '';
|
$data['sys_labels_arr'] = [];
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,6 @@ class GoodsLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
if($params['sys_labels']){
|
|
||||||
$sys_labels=explode(',',$params['sys_labels']);
|
|
||||||
$params['sys_labels']=','.implode(',',$sys_labels).',';
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Goods::create([
|
Goods::create([
|
||||||
@ -75,10 +71,6 @@ class GoodsLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
if($params['sys_labels']){
|
|
||||||
$sys_labels=explode(',',$params['sys_labels']);
|
|
||||||
$params['sys_labels']=','.implode(',',$sys_labels).',';
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Goods::where('id', $params['id'])->update([
|
Goods::where('id', $params['id'])->update([
|
||||||
|
@ -27,10 +27,6 @@ class SupplierLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
if($params['sys_labels']){
|
|
||||||
$sys_labels=explode(',',$params['sys_labels']);
|
|
||||||
$params['sys_labels']=','.implode(',',$sys_labels).',';
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Supplier::create([
|
Supplier::create([
|
||||||
@ -80,10 +76,6 @@ class SupplierLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
if($params['sys_labels']){
|
|
||||||
$sys_labels=explode(',',$params['sys_labels']);
|
|
||||||
$params['sys_labels']=','.implode(',',$sys_labels).',';
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Supplier::where('id', $params['id'])->update([
|
Supplier::where('id', $params['id'])->update([
|
||||||
|
9
app/api/controller/order/StatisticsController.php
Normal file
9
app/api/controller/order/StatisticsController.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\api\controller\order;
|
||||||
|
use app\api\controller\BaseApiController;
|
||||||
|
|
||||||
|
class StatisticsController extends BaseApiController{
|
||||||
|
public function lists(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
66
app/api/lists/order/StatisticsList.php
Normal file
66
app/api/lists/order/StatisticsList.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\lists\order;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\goods\Goods;
|
||||||
|
use app\common\model\retail\Cashierclass;
|
||||||
|
use app\common\model\retail\Cashierinfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计列表
|
||||||
|
* Class RetailOrderList
|
||||||
|
* @package app\api\order
|
||||||
|
*/
|
||||||
|
class StatisticsList extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author likeadmin
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['paid','status','source'],
|
||||||
|
'between_time' => 'create_time',
|
||||||
|
'%like%' => ['number'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 零售订单列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @date 2024/04/27 11:26
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
$userId=$this->request->userId;
|
||||||
|
if(!$userId) return [];
|
||||||
|
return Cashierclass::where($this->searchWhere)->where('uid',$userId)
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 零售订单数量
|
||||||
|
* @return int
|
||||||
|
* @date 2024/04/27 11:26
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return Cashierclass::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,17 +23,16 @@ class Goods extends BaseModel
|
|||||||
{
|
{
|
||||||
return explode(',',$value);
|
return explode(',',$value);
|
||||||
}
|
}
|
||||||
public function setSysLabelAttr($value)
|
public function setSysLabelsAttr($value)
|
||||||
{
|
{
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
if (!is_array($value))
|
$sys_labels=explode(',',$value);
|
||||||
return ','. $value .',';
|
return ','.implode(',',$sys_labels).',';
|
||||||
return ','. implode(',', $value) .',';
|
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSysLabelAttr($value)
|
public function getSysLabelsAttr($value)
|
||||||
{
|
{
|
||||||
if (!$value) return [];
|
if (!$value) return [];
|
||||||
return explode(',',rtrim(ltrim($value,','),','));
|
return explode(',',rtrim(ltrim($value,','),','));
|
||||||
|
@ -19,6 +19,19 @@ class Supplier extends BaseModel
|
|||||||
protected $name = 'supplier';
|
protected $name = 'supplier';
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
public function setSysLabelsAttr($value)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
$sys_labels=explode(',',$value);
|
||||||
|
return ','.implode(',',$sys_labels).',';
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
public function getSysLabelsAttr($value)
|
||||||
|
{
|
||||||
|
if (!$value) return [];
|
||||||
|
return explode(',',rtrim(ltrim($value,','),','));
|
||||||
|
}
|
||||||
public function userAuth()
|
public function userAuth()
|
||||||
{
|
{
|
||||||
return $this->hasOne(UserAuth::class, 'id', 'uid')->bind(['openid']);
|
return $this->hasOne(UserAuth::class, 'id', 'uid')->bind(['openid']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user