예제 #1
0
파일: Site.php 프로젝트: houdunwang/hdcms
 /**
  * 初始化站点的会员字段信息数据
  *
  * @param int $siteId 站点编号
  *
  * @return bool
  */
 public function InitializationSiteTableData($siteId)
 {
     $SiteSetting = new SiteSetting();
     $SiteSetting['siteid'] = $siteId;
     $SiteSetting['creditnames'] = ['credit1' => ['title' => '积分', 'status' => 1], 'credit2' => ['title' => '余额', 'status' => 1], 'credit3' => ['title' => '', 'status' => 0], 'credit4' => ['title' => '', 'status' => 0], 'credit5' => ['title' => '', 'status' => 0]];
     $SiteSetting['register'] = ['focusreg' => 0, 'item' => 2];
     $SiteSetting['creditbehaviors'] = ['activity' => 'credit1', 'currency' => 'credit2'];
     $SiteSetting->save();
     //添加默认会员组
     $MemberGroup = new MemberGroup();
     $MemberGroup['siteid'] = $siteId;
     $MemberGroup['title'] = '会员';
     $MemberGroup['isdefault'] = 1;
     $MemberGroup['is_system'] = 1;
     $MemberGroup->save();
     //创建用户字段表数据
     $memberField = new MemberFields();
     $memberField->where('siteid', $siteId)->delete();
     $profile_fields = Db::table('profile_fields')->get();
     foreach ($profile_fields as $f) {
         $d['siteid'] = $siteId;
         $d['field'] = $f['field'];
         $d['title'] = $f['title'];
         $d['orderby'] = $f['orderby'];
         $d['status'] = $f['status'];
         $memberField->insert($d);
     }
     return TRUE;
 }
예제 #2
0
파일: site.php 프로젝트: houdunwang/hdcms
 public function doSiteFieldPost()
 {
     $id = Request::get('id', 0, 'intval');
     $model = new MemberFields();
     $field = Db::table('member_fields')->where('siteid', SITEID)->find($id);
     if (empty($field)) {
         message('你编辑的字段不存在', 'back', 'error');
     }
     if (IS_POST) {
         $model['id'] = Request::get('id');
         $model['orderby'] = Request::post('orderby');
         $model['title'] = Request::post('title');
         $model['status'] = Request::post('status');
         $model->save();
         message('修改字段成功', site_url('FieldLists'), 'success');
     }
     return view($this->template . '/field_post.html')->with('field', $field);
 }