SceneEnum::data(), ]; } /** * 关联会员记录表 * @return \think\model\relation\BelongsTo */ public function user() { $module = self::getCalledModule() ?: 'common'; return $this->belongsTo("app\\{$module}\\model\\User"); } /** * 余额变动场景 * @param $value * @return array */ public function getSceneAttr($value) { return ['text' => SceneEnum::data()[$value]['name'], 'value' => $value]; } /** * 新增记录 * @param $scene * @param $data * @param $describeParam */ public static function add($scene, $data, $describeParam) { $model = new static; $model->save(array_merge([ 'scene' => $scene, 'describe' => vsprintf(SceneEnum::data()[$scene]['describe'], $describeParam), 'wxapp_id' => $model::$wxapp_id ], $data)); } }