Commit 42b42f41 authored by shajiaming's avatar shajiaming

应用准备条件

parent 9cf63f40
......@@ -31,7 +31,7 @@ class ExploreController extends BaseController
foreach ($app_category_model as $key => $val) {
unset($val->apps);
$val->name = isset($val->name[$this->lang]) ? $val->name[$this->lang] : '';
$apps_model = ExploreApp::find()->select('id, name, icon, type, app_url, slogan')
$apps_model = ExploreApp::find()->select('id, name, icon, type, app_url, slogan, email, phone, real_name')
->where(['app_category_id' => (int)$val->id, 'status' => ExploreApp::STATUS_ON])
->orderBy('sort')
->limit($val->limit)
......@@ -111,7 +111,7 @@ class ExploreController extends BaseController
$id_arr = explode(',', $ids);
$order = "FIELD(`id`,$ids)";
$apps_model = ExploreApp::find()->select('id, name, icon, type, app_url, slogan')
$apps_model = ExploreApp::find()->select('id, name, icon, type, app_url, slogan, email, phone, real_name')
->where(['status' => ExploreApp::STATUS_ON])
->andWhere(['in', 'id', $id_arr])
->orderBy([$order => true])
......
......@@ -30,8 +30,9 @@ class ExploreApp extends BaseActiveRecord
public function rules()
{
return [
[['name', 'icon', 'app_url', 'type', 'sort', 'status', 'platform_id', 'app_category_id'], 'required'],
[['type', 'sort', 'status', 'platform_id', 'app_category_id'], 'integer'],
[['name', 'icon', 'app_url', 'type', 'sort', 'status', 'platform_id', 'app_category_id', 'email', 'phone', 'real_name'], 'required'],
[['type', 'sort', 'status', 'platform_id', 'app_category_id', 'email', 'phone', 'real_name'], 'integer'],
[['email', 'phone', 'real_name'], 'in', 'range' => array(0, 1)],
['slogan', 'string', 'max' => 50],
[['slogan'], 'safe'],
[['icon'], 'url']
......@@ -47,15 +48,18 @@ class ExploreApp extends BaseActiveRecord
'slogan' => '应用宣传语',
'type' => '应用类型',
'sort' => '应用排序',
'status' => '应用状态'
'status' => '应用状态',
'phone' => '准入条件 - 手机',
'email' => '准入条件 - 邮箱',
'real_name' => '准入条件 - 实名'
];
}
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['name', 'icon', 'app_url', 'slogan', 'type', 'sort', 'status', 'platform_id', 'app_category_id'],
self:: SCENARIOS_UPDATE => ['id', 'name', 'icon', 'app_url', 'slogan', 'type', 'sort', 'status', 'platform_id', 'app_category_id'],
self:: SCENARIOS_CREATE => ['name', 'icon', 'app_url', 'slogan', 'type', 'sort', 'status', 'platform_id', 'app_category_id', 'email', 'phone', 'real_name'],
self:: SCENARIOS_UPDATE => ['id', 'name', 'icon', 'app_url', 'slogan', 'type', 'sort', 'status', 'platform_id', 'app_category_id', 'email', 'phone', 'real_name'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
......
......@@ -232,7 +232,7 @@ class ExploreAppController extends BaseController
if (Yii::$app->request->isGet) {
$id = Yii::$app->request->get('id');
$data = ExploreApp::find()->select('id, name, icon, app_url, slogan, type, sort, status')->where(['platform_id' => $platform_id, 'id' => $id])->asArray()->one();
$data = ExploreApp::find()->select('id, name, icon, app_url, slogan, type, sort, status, email, phone, real_name')->where(['platform_id' => $platform_id, 'id' => $id])->asArray()->one();
goto doEnd;
}
......
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 to comment