|
|
@@ -9,42 +9,9 @@ class xhWxOpenService {
|
|
|
|
|
|
public static function getById($id=0)
|
|
|
{
|
|
|
- $defaultId = configDict::getConfig('openId');
|
|
|
- $id = empty($id) ? $defaultId : $id;
|
|
|
- $preKey = configDict::getCacheKey('wxOpen');
|
|
|
- $cacheKey = $preKey.$id;
|
|
|
- $cacheData = Yii::$app->redis->executeCommand('HGETALL', [$cacheKey]);
|
|
|
- $data = [];
|
|
|
- $list = [];
|
|
|
- if(!empty($cacheData)){
|
|
|
- if(!empty($cacheData)){
|
|
|
- $x = 0;
|
|
|
- foreach($cacheData as $cKey => $cVal){
|
|
|
- if($cKey%2 == 0){
|
|
|
- $list[$x]['key'] = $cVal;
|
|
|
- }else{
|
|
|
- $list[$x]['value'] = $cVal;
|
|
|
- $x++;
|
|
|
- }
|
|
|
- }
|
|
|
- foreach($list as $lKey => $lVal){
|
|
|
- $data[$lVal['key']] = $lVal['value'];
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- $condition = ['id' => $id];
|
|
|
- $merchant = xhWxOpen::getByCondition($condition);
|
|
|
- if(!empty($merchant)){
|
|
|
- $arr = [$cacheKey];
|
|
|
- foreach($merchant as $key => $val){
|
|
|
- $arr[] = $key;
|
|
|
- $arr[] = $val;
|
|
|
- }
|
|
|
- Yii::$app->redis->executeCommand('HMSET', $arr);
|
|
|
- }
|
|
|
- $data = $merchant;
|
|
|
- }
|
|
|
- return $data;
|
|
|
+ $condition = ['id' => $id];
|
|
|
+ $merchant = xhWxOpen::getByCondition($condition);
|
|
|
+ return $merchant;
|
|
|
}
|
|
|
|
|
|
public static function updateById($id, $data)
|