mStoreID; $product = $thrid_refill->getProviderProduct($store_id, $goods_id, $sys_pcode); if (empty($product)) { return false; } else { return $product['channel_code']; } } //启用主动查询功能 public function callback() { return false; } public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array { $order_sn = $params['order_sn']; $goods_id = intval($params['goods_id']); $channel_code = $this->getProductCode($goods_id, $params['product_code']); if (empty($channel_code)) { return [false, '产品有误', false]; } $mchid = $params['mchid']; $times = config::getTimes($channel_code); if($times <= 0) { return [false, '产品有误', false]; } $model_merchant = Model('merchant'); $data = [ 'query_total_times' => ['exp', "query_total_times+$times"], 'query_left_times' => ['exp', "query_left_times+$times"] ]; $ret = $model_merchant->editMerchant($data, ['mchid' => $mchid]); if($ret) { return [true, $order_sn, false]; } else { return [true, '更新数据库出错', false]; } } public function query($refill_info): array { $order_sn = $refill_info['order_sn']; $ch_trade_no = $refill_info['ch_trade_no']; if ($order_sn == $ch_trade_no) { return [true, ORDER_STATE_SUCCESS, '']; } else { return [true, ORDER_STATE_SEND, '']; } } public function balance(): array { return [true, 0]; } }