/** * 将消息和用户关联 * @param MessageModel $p_msgModel 消息模型 * @param array $p_queryWhere 用户的筛选方案 * @return int 关联个数 */ public static function createNewModels($p_msgModel, $p_queryWhere = array()) { $userIDs = DBModel::instance('user')->where($p_queryWhere)->selectValues('id'); $tmpData = array(); $tmpData['msgID'] = $p_msgModel->getId(); $tmpData['readStatus'] = READ_STATUS::UNREAD; $tmpData['createTime'] = date('Y-m-d H:i:s'); $tmpData['modifyTime'] = date('Y-m-d H:i:s'); $dbFac = static::newDBModel(); foreach ($userIDs as $userID) { $tmpData['userID'] = $userID; $dbFac->insert($tmpData); } //推送 if (count($userIDs) > 0) { $p_where = array(); $p_where['joinList'] = array(); $p_where['joinList'][] = array('relationMessageUser t2', array('t2.userID = t1.userID', 't2.msgID' => $p_msgID, 't2.readStatus' => READ_STATUS::UNREAD)); DeviceController::pushSingleMessage($p_where, $p_msgModel->getTitle(), $p_msgModel->getDescription(), $customtype = null, $customvalue = null, $tag_name = null); } return count($userIDs); }
$orderFac = DBModel::instance('orderDetail')->where(array('id' => $out_trade_no)); $tmpOrder = $orderFac->selectSingle(); if (is_array($tmpOrder)) { if ($tmpOrder['orderStatus'] == 26) { $orderFac->update(array('orderStatus' => 41)); DBModel::instance('orderActionLog')->insert(array('userID' => $tmpOrder['userID'], 'orderDetailID' => $tmpOrder['id'], 'orderStatus' => 32, 'createTime' => date('Y-m-d H:i:s'), 'modifyTime' => date('Y-m-d H:i:s'))); DBModel::instance('orderActionLog')->insert(array('userID' => $tmpOrder['userID'], 'orderDetailID' => $tmpOrder['id'], 'orderStatus' => 41, 'createTime' => date('Y-m-d H:i:s'), 'modifyTime' => date('Y-m-d H:i:s'))); } } } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— echo "success"; //请不要修改或删除 $tmpLog['verify_result'] = 'success'; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } else { //验证失败 echo "fail"; $tmpLog['verify_result'] = 'fail'; //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } $logKeyArray = array('notify_type', 'notify_id', 'sign_type', 'sign', 'out_trade_no', 'subject', 'payment_type', 'trade_no', 'trade_status', 'seller_id', 'seller_email', 'buyer_id', 'buyer_email', 'total_fee', 'quantity', 'price', 'body', 'gmt_create', 'gmt_payment', 'is_total_fee_adjust', 'use_coupon', 'discount', 'refund_status', 'gmt_refund'); foreach ($logKeyArray as $logKey) { if (array_key_exists($logKey, $_POST)) { $tmpLog[$logKey] = $_POST[$logKey]; } } $tmpLog['createTime'] = date('Y-m-d H:i:s'); DBModel::instance('alipayOrderLog')->insert($tmpLog);