常用核心数据

获取项目列表(带模块)

  1. $condition = "module>0";
  2. $project_list = $this->model('project')->get_all_project($this->session->val('admin_site_id'),$condition);
  3. $this->assign('project_list',$project_list);

插件列表项目显示

  1. <div class="table">
  2. <div class="title">
  3. 项目:<span class="note">请指定项目</span>
  4. </div>
  5. <div class="content">
  6. <select id="pid" name="pid">
  7. <option value="">请选择…</option>
  8. <!-- loop from=$project_list key=$key value=$value id=$tmpid -->
  9. <option value="{$value.id}"{if $rs.param && $rs.param.pid == $value.id} selected{/if}>{$value.space}{$value.title}</option>
  10. <!-- /loop -->
  11. </select>
  12. </div>
  13. </div>

获取支付方案列表

$condition = "p.status=1";
$paylist = $this->model('payment')->get_all('p.status=1','id');
$this->assign('paylist',$paylist);

获取网关路由

$glist = $this->model('gateway')->get_all(0);
$this->assign('gateway_sms_list',$glist['sms']['list']);//短信网关列表
$this->assign('gateway_email_list',$glist['email']['list']);//邮件网关列表

通过网关发送邮件

$this->gateway('type','email');
$this->gateway('param','网关ID'); //使用default自动调用默认网关,不使用默认,请填写网关ID,数字
//基于通知模板ID来获取相应的模板信息
$tpl = $this->model('email')->get_one('通知模板ID');
//基于标识来获取模板信息,两者选其一就可以了
$tpl = $this->model('email')->get_tpl('通知模板标识');
//邮件标题,支持变量
$title = $this->fetch($tpl['title'],'msg');
//邮件内容,支持变量(注意,不支持相对路径,要写全部网址,不然收到的邮件可能看到不图片)
$content = $this->fetch($tpl['content'],'msg');
$array = array('email'=>'目标邮箱','fullname'=>'称呼','title'=>$title,'content'=>$content);
$this->gateway('exec',$array);

通过网关发送短信

$this->gateway('type','sms');
$this->gateway('param','网关ID'); //使用default自动调用默认网关,不使用默认,请填写网关ID,数字
//基于通知模板ID来获取相应的模板信息
$tpl = $this->model('email')->get_one('通知模板ID');
//基于标识来获取模板信息,两者选其一就可以了
$tpl = $this->model('email')->get_tpl('通知模板标识');
//短信标题,无效,不发送
$title = $this->fetch($tpl['title'],'msg');
//短信内容,支持变量。
$content = $this->fetch($tpl['content'],'msg');
$array = array('mobile'=>'手机号','identifier'=>$tpl['identifier'],'title'=>$title,'content'=>$content);
$this->gateway('exec',$array);

常用分页代码:

$string = "home=首页&prev=上一页&next=下一页&last=尾页&half=5&add=(total)/(psize)&always=1";
$pagelist = phpok_page($pageurl,$total,$pageid,$psize,$string);
$this->assign('pagelist',$pagelist);
$this->assign('pageurl',$pageurl);
$this->assign('total',$total);
$this->assign('pageid',$pageid);
$this->assign('psize',$psize);
$this->assign('offset',$offset);

手动加减积分:

$this->model('wealth')->save_val($wid,$uid,$val,$note)

其中:

$wid,表示财富ID,是数值

$uid,表示会员ID,是数值

$val,要增加或扣除的积分,扣除前写加 - 号,例如加10分,就写 10,扣10分,就写 -10

$note,备注