| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\models\agent\front_erp;
- use app\models\ErpInventory;
- use app\models\ErpInventoryLog;
- use app\models\ErpSupplier;
- use app\models\Goods;
- use app\models\Option;
- use app\constants\OptionSetting;
- use app\modules\admin\models\agent\front_erp\Model;
- class ERP extends Model
- {
-
- public static function conf($front_agent_admin_id){
- $conf = json_decode(Option::get(OptionSetting::ERP, $front_agent_admin_id, 'agent_front', '{}')['value'], true);
- return [
- 'code'=>0,
- 'data' => $conf,
- ];
- }
- public static function confSave($front_agent_admin_id, $conf){
- $oldConf = self::conf($front_agent_admin_id)['data'];
- $data = array_merge($oldConf, $conf);
- $set = Option::set(OptionSetting::ERP, json_encode($data), $front_agent_admin_id, 'agent_front');
- return [
- 'code'=>$set ? 0 : 1,
- 'msg'=>$set ? '保存成功' : '保存失败',
- ];
- }
-
- public static function getWarningNum($front_agent_admin_id){
- $conf = self::conf($front_agent_admin_id)['data'];
- return $conf ? $conf['warning_num'] : null;
- }
- public static function saveWarningNum($front_agent_admin_id, $warning_num){
- $conf = ['warning_num' => $warning_num];
- return self::confSave($front_agent_admin_id, $conf);
- }
-
- }
|