onlineUserId = $onlineUserId; $this->onlineEnterpriseId = $onlineEnterpriseId; $this->objDOrderReceive = new DOrderReceive('default'); self::orderReceiveSubTable($onlineEnterpriseId, $onlineUserId); } /** * 订单收货分表 * @param $enterpriseId (企业id) * @param $userId (用户id) * @throws \Exception */ public function orderReceiveSubTable($enterpriseId, $userId) { $tableName = $this->objDOrderReceive->getTableName($this->objDOrderReceive->get_Table() . '_' . $enterpriseId, $userId, $this->cutTable); $this->objDOrderReceive->setTable($tableName); } /** * 添加订单收货信息 * @param $params * @return ResultWrapper * @throws \Exception */ public function addOrderReceive($params) { $dbResult = $this->objDOrderReceive->insert($params); if ($dbResult === false) { return ResultWrapper::fail($this->objDOrderReceive->error(), ErrorCode::$dberror); } else { return ResultWrapper::success($dbResult); } } /** * 通过订单id,获取订单收货信息 * @param $selectParams ['orderId'=>[1,2,3]] * @return ResultWrapper */ public function getOrderReceiveByOrderIds($selectParams) { $dbResult = $this->objDOrderReceive->select($selectParams, 'id,orderId,customerId,address,realName,mobile,cityCode,districtCode,provinceCode'); if ($dbResult === false) { return ResultWrapper::fail($this->objDOrderReceive->error(), ErrorCode::$dberror); } else { return ResultWrapper::success($dbResult); } } /** * 更新收货数据 * * @param $data * @param $where * @return ResultWrapper */ public function updateReceive($data, $where) { $dbResult = $this->objDOrderReceive->update($data, $where); if ($dbResult === false) { return ResultWrapper::fail($this->objDOrderReceive->error(), ErrorCode::$dberror); } else { return ResultWrapper::success($dbResult); } } /** * Doc: (des="订单收货地址数据") * User: XMing * Date: 2020/11/4 * Time: 10:04 上午 * @param array $params * @return array */ public static function buildOrderReceive(array $params): array { return [ "no" => isset($params['no']) ? $params['no'] : '', //char(25) NOT NULL COMMENT '订单编号', "orderId" => isset($params['orderId']) ? $params['orderId'] : 0, //int(10) NOT NULL DEFAULT '0' COMMENT '订单Id', "customerId" => isset($params['customerId']) ? $params['customerId'] : 0, //int(10) NOT NULL DEFAULT '0' COMMENT '客户Id', "customerCode" => isset($params['customerCode']) ? $params['customerCode'] : '', //varchar(255) DEFAULT '' COMMENT '客户编码', "realName" => isset($params['name']) ? $params['name'] : '', //varchar(255) NOT NULL DEFAULT '' COMMENT '收货人姓名', "mobile" => isset($params['mobile']) ? $params['mobile'] : '', //char(11) NOT NULL DEFAULT '' COMMENT '收货人电话', "address" => isset($params['address']) ? $params['address'] : '', //varchar(255) NOT NULL DEFAULT '' COMMENT '收货详细地址', "provinceCode" => isset($params['provinceCode']) ? $params['provinceCode'] : '', //int(10) DEFAULT '0' COMMENT '省份编码', "cityCode" => isset($params['cityCode']) ? $params['cityCode'] : '', //int(10) DEFAULT '0' COMMENT '城市编码', "districtCode" => isset($params['districtCode']) ? $params['districtCode'] : '', //int(10) DEFAULT '0' COMMENT '区编码', "remark" => isset($params['remark']) ? $params['remark'] : '', //varchar(255) NOT NULL DEFAULT '' COMMENT '收货备注', "deleteStatus" => StatusCode::$standard, //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除 默认5 正常 4删除', "createTime" => time(), //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间', "updateTime" => time(), //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间', "detailAddress" => isset($params['detailAddress']) ? $params['detailAddress'] : '', //varchar(255) DEFAULT '' COMMENT '详细收货地址', ]; } }