public function sendRedGiftForCustomer($newOpenid, $oldOpenid) { //取出配置信息 $SetRedpacketModel = new SetRedpacketModel(); $config = $SetRedpacketModel->init(); //老用户发红包 if ($config['old_state'] == true && $oldOpenid != '') { $WechatRedpacketModel = new WechatRedpacketModel(); $count = $WechatRedpacketModel->getCountsByOpenid($oldOpenid); if ($count <= $config['old_max_num']) { $this->send($config['send_name'], $config['send_name'], $oldOpenid, $config['old_min_value'], $config['old_max_value'], trim($config['wishing']), $config['act_name'], $config['remark']); } } //新用户发红包 if ($config['new_state'] == true) { //判断是否直接关注 if ($oldOpenid == '') { if ($config['attention_give'] == false) { return; } } //按规则发放红包 $this->send($config['send_name'], $config['send_name'], $newOpenid, $config['new_min_value'], $config['new_max_value'], trim($config['wishing']), $config['act_name'], $config['remark']); } }
public function indexAction() { $setPacketM = new SetRedpacketModel(); $res = $setPacketM->init(); $this->assign('list', $res); $this->assign('update', U('update')); $this->assign('YZRight', $this->fetch()); $this->display(YZ_TEMPLATE); }