Ai
1 Star 0 Fork 0

影子/fx_activity

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
processor.php 3.57 KB
一键复制 编辑 原始数据 按行查看 历史
mink7 提交于 2020-09-27 12:06 +08:00 . 更换微擎后台项目名
<?php
/**
* 活动报名模块处理程序
*
* @author 奔跑的蜗牛
* @url http://bbs.we7.cc/
*/
defined('IN_IA') or exit('Access Denied');
define("MODULE_NAME", "aide_activity");
require IA_ROOT . '/addons/' . MODULE_NAME . '/core/common/defines.php';
require aide_CORE . '/class/loader.class.php';
$autoload = aide_CORE . '/class/autoload.php';
if(file_exists($autoload)) require $autoload;
class aide_activityModuleProcessor extends WeModuleProcessor {
public function respond() {
global $_W;
//这里定义此模块进行消息处理时的具体过程, 请查看微擎文档来编写你的代码
$message = $this -> message;
$openid = $this -> message['from'];
$content = $this -> message['content'];
$msgtype = strtolower($message['msgtype']);
$event = strtolower($message['event']);
if ($msgtype == 'text' || $event == 'click') {
$saler = pdo_fetch('select * from ' . tablename('aide_saler') . " where INSTR(`openid`, '$openid') and status=:status and uniacid=:uniacid", array(':status' => 1, ':uniacid' => $_W['uniacid']));
if (empty($saler)) {
$this -> endContext();
return $this -> respText('您无核销权限!');
return $this -> salerEmpty();
}
if (!$this -> inContext) {
$this -> beginContext();
return $this -> respText('请输入核销码:');
} else if ($this -> inContext && is_numeric($content)) {
$records = pdo_fetch('select * from ' . tablename('aide_activity_records') . ' where hexiaoma=:hexiaoma and uniacid=:uniacid', array(':hexiaoma' => $content, ':uniacid' => $_W['uniacid']));
if (empty($records)) {
return $this -> respText('未找到要核销的报名,请重新输入!');
}
if ($records['ishexiao'] == 1) {
$this -> endContext();
return $this -> respText('此报名已核销,无需重复核销!');
}
if ($records['status'] != 1 && $records['status'] != 2) {
$this -> endContext();
return $this -> respText('报名状态错误,无法核销!');
}
$storeids = array();
$salerids = array();
$activity = pdo_fetch("select storeids from " . tablename('aide_activity')." where id=:id and uniacid=:uniacid ", array(':uniacid' => $_W['uniacid'], ':id' => $records['activityid']));
$storeids = array_merge(unserialize($activity['storeids']), $storeids);
$salerids = array_merge(explode(',', $saler['storeid']), $salerids);
if (!empty($saler['storeid'])) {
$inter = array_intersect($storeids, $salerids);
if (empty($inter)) {
return $this -> respText('您对当前活动无核销权限!');
}
}
$data = array(
'payprice' => $records['price'],
'status'=>3,
'ishexiao'=>1,
'veropenid' => $openid,
'sendtime'=>date('Y-m-d H:i:s',TIMESTAMP)
);
$result = pdo_update('aide_activity_records', $data, array('id' => $records['id']));
if(!empty($records['merchantid']) && !empty($records['price'])){
pdo_insert("aide_merchant_money_record",array('merchantid'=>$records['merchantid'],'uniacid'=>$_W['uniacid'],'money'=>$records['price'],'recordsid'=>$records['id'],'createtime'=>TIMESTAMP,'type'=>2,'detail'=>'关键词核销<br>订单号:'.$records['orderno']));
if($records['paytype']=='wechat' || $records['paytype']=='alipay')//只有微信、支付宝成功支付的才可更新结算金额
model_merchant::updateNoSettlementMoney($records['price'], $records['merchantid']);//更新可结算金额
}
$this -> endContext();
return $this -> respText('核销成功!');
}
}
}
private function salerEmpty() {
ob_clean();
ob_start();
echo '';
ob_flush();
ob_end_flush();
exit(0);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhuanggitee/fx_activity.git
git@gitee.com:zhuanggitee/fx_activity.git
zhuanggitee
fx_activity
fx_activity
master

搜索帮助