|
@@ -0,0 +1,60 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by north.Deng's MAC
|
|
|
+ * User: north.Deng
|
|
|
+ * Date: 2018/2/28
|
|
|
+ * Time: 下午12:30
|
|
|
+ * description :
|
|
|
+ */
|
|
|
+class JCommunityController extends AdminController
|
|
|
+{
|
|
|
+ protected $fileds = [
|
|
|
+ 'user_id' => '用户ID',
|
|
|
+ 'name' => '用户名',
|
|
|
+ 'mobile' => '手机',
|
|
|
+ 'phone' => '电话',
|
|
|
+ 'email' => '邮箱',
|
|
|
+ 'birth' => '生日',
|
|
|
+ 'sex' => '性别',
|
|
|
+ 'address' => '地址',
|
|
|
+ 'address_number' => '邮编',
|
|
|
+ 'street' => '街道',
|
|
|
+ 'card_number' => '身份证号',
|
|
|
+ 'desc' => '备注',
|
|
|
+ ];
|
|
|
+ public function actionAdd()
|
|
|
+ {
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+ foreach ($this->fileds as $filed => $v) {
|
|
|
+ $data[$filed] = Yii::app()->request->getParam($filed,'');
|
|
|
+ if (empty($data[$filed])) {
|
|
|
+ CommonFn::requestAjax(false, '请填写完整数据', array($filed));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $community = new Community();
|
|
|
+ $community->user_id = $data['user_id'];
|
|
|
+ $community->user_info = [
|
|
|
+ 'name' => $data['name'],
|
|
|
+ 'mobile' => $data['mobile'],
|
|
|
+ 'phone' => $data['phone'],
|
|
|
+ 'email' => $data['email'],
|
|
|
+ 'birth' => strtotime($data['birth']),
|
|
|
+ 'sex' => (int)$data['sex'],
|
|
|
+ ];
|
|
|
+ $community->register_time = time();
|
|
|
+ $community->address_number = $data['address_number'];
|
|
|
+ $community->address = $data['address'];
|
|
|
+ $community->street = $data['street'];
|
|
|
+ $community->card_number = $data['card_number'];
|
|
|
+ $community->desc = $data['desc'];
|
|
|
+ $community->address = $data['address'];
|
|
|
+ $community->save();
|
|
|
+ CommonFn::requestAjax(true,'创建成功');exit;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|