Commit e6b9fb38 by 杨树贤

优化

parent b2bb2ce7
Showing with 6 additions and 6 deletions
......@@ -70,20 +70,20 @@ class SupplierExtendModel extends Model
public function getExtendExtra($SupplierCode = '', $SupplierID = '')
{
if (empty($SupplierCode)) return false;
$Redis = new RedisModel();
$pre = Config('fixed.SUPPLIER_REDIS_PRE');
$SUPPLIER_ID = Config('fixed.SUPPLIER_ID'); // 联营供应商ID 17
$extendInfo = $Redis->hget($pre, $SUPPLIER_ID . '.' . $SupplierCode); // 联营供应商ID是17,储存内容格式如下{"max":2000,"price":10}
if (empty($extendInfo)) {
// 先从数据库获取
$charge_content = $this->select(['charge_content'])->where('supplier_id', '=', $SupplierID)->where('status', '=', 1)->first();
$extendInfo = '';
if (!empty($charge_content)) {
$charge_content = $charge_content->toArray();
$extendInfo = $charge_content['charge_content'];
}
// 如果数据库有数据,同步到 Redis
if (!empty($extendInfo)) {
$Redis = new RedisModel();
$pre = Config('fixed.SUPPLIER_REDIS_PRE');
$SUPPLIER_ID = Config('fixed.SUPPLIER_ID'); // 联营供应商ID 17
$Redis->hset($pre, $SUPPLIER_ID . '.' . $SupplierCode, $extendInfo);
}
}
if ($extendInfo) {
$extendInfo = json_decode($extendInfo, true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment