初始上传

This commit is contained in:
2026-04-04 17:27:12 +08:00
parent 4d80d28eb4
commit b7e11774ee
11191 changed files with 1588469 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\card\RealCard;
use app\api\controller\BaseApi;
/**
* 激活礼品卡
*/
class Activate extends BaseApi
{
/**
* 激活
*/
public function activate()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$card_no = $this->params[ 'card_no' ] ?? '';
$card_cdk = $this->params[ 'card_cdk' ] ?? '';
$realcard_model = new RealCard();
$params = array (
'card_no' => $card_no,
'card_cdk' => $card_cdk,
'member_id' => $this->member_id,
'site_id' => $this->site_id
);
$result = $realcard_model->memberCardActivate($params);
return $this->response($result);
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\card\Card as CardModel;
use app\api\controller\BaseApi;
/**
* 礼品卡
*/
class Card extends BaseApi
{
/**
* 活动详情
*/
public function detail()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$card_id = $this->params[ 'card_id' ] ?? 0;
$card_model = new CardModel();
$params = array (
'site_id' => $this->site_id,
'card_id' => $card_id
);
$detail = $card_model->getCardDetail($params);
return $this->response($detail);
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\card\CardOperation;
use app\api\controller\BaseApi;
/**
* 礼品卡使用
*/
class Carduse extends BaseApi
{
/**
* 储值礼品卡使用
*/
public function balanceUse()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$member_card_id = $this->params[ 'member_card_id' ] ?? 0;
$card_operation_model = new CardOperation();
$params = array (
'site_id' => $this->site_id,
'member_id' => $this->member_id,
'member_card_id' => $member_card_id
);
$result = $card_operation_model->cardUse($params);
return $this->response($result);
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\giftcard\Category as CategoryModel;
use app\api\controller\BaseApi;
/**
* 礼品卡分类
*/
class Category extends BaseApi
{
/**
* 列表信息
*/
public function lists()
{
$page = $this->params['page'] ?? 1;
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
$search_text = $this->params['search_text'] ?? '';
$condition = array (
[ 'site_id', '=', $this->site_id ],
);
if (!empty($search_text)) {
$condition[] = [ 'category_name', 'like', '%' . $search_text . '%' ];
}
$category_model = new CategoryModel();
$list = $category_model->getPageList($condition, $page, $page_size);
return $this->response($list);
}
}

View File

@@ -0,0 +1,113 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\giftcard\Category as CategoryModel;
use addon\giftcard\model\giftcard\GiftCard as GiftCardModel;
use addon\giftcard\model\giftcard\Media;
use app\api\controller\BaseApi;
use app\model\shop\Shop;
use think\facade\Db;
/**
* 礼品卡
*/
class Giftcard extends BaseApi
{
/**
* 列表信息
*/
public function lists()
{
$card_type = $this->params['card_type'] ?? '';
$page = $this->params['page'] ?? 1;
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
$search_text = $this->params['search_text'] ?? '';
$category_id = $this->params['category_id'] ?? 0;
$condition = array (
[ 'site_id', '=', $this->site_id ],
[ 'status', '=', '1' ],
[ 'is_delete', '=', '0' ],
[ 'card_type', '=', 'virtual' ],
);
if (!empty($search_text)) {
$condition[] = [ 'card_name', 'like', '%' . $search_text . '%' ];
}
if (!empty($card_type)) {
$condition[] = [ 'card_type', '=', $card_type ];
}
if ($category_id > 0) {
$condition[] = [ 'category_id', '=', $category_id ];
}
$giftcard_model = new GiftCardModel();
$list = $giftcard_model->getGiftcardDetailPageList($condition, $page, $page_size, 'sort desc');
return $this->response($list);
}
/**
* 活动详情
*/
public function detail()
{
$giftcard_id = $this->params['giftcard_id'] ?? 0;
$giftcard_model = new GiftCardModel();
$media_model = new Media();
$detail = $giftcard_model->getGiftcardDetail([ 'giftcard_id' => $giftcard_id, 'site_id' => $this->site_id ])[ 'data' ] ?? [];
$order = Db::raw('field(media_id, ' . $detail[ 'media_ids' ] . ')');
$detail[ 'media_list' ] = $media_model->getList([ [ 'media_id', 'in', $detail[ 'media_ids' ] ] ], '*', $order)[ 'data' ] ?? [];
$detail[ 'mobile' ] = ( new Shop() )->getShopInfo([ [ 'site_id', '=', $this->site_id ] ], 'mobile')[ 'data' ][ 'mobile' ] ?? '';
$detail[ 'giftcard_desc' ] = $giftcard_model->giftcardDesc($detail) ?? '';
return $this->response($this->success($detail));
}
/**
* 分类下礼品卡
*/
public function giftcardListByCategory()
{
$condition = array (
[ 'site_id', '=', $this->site_id ],
);
if (!empty($search_text)) {
$condition[] = [ 'category_name', 'like', '%' . $search_text . '%' ];
}
$category_model = new CategoryModel();
$list = $category_model->getList($condition, '*', 'sort desc');
$giftcard_model = new GiftCardModel();
$giftcard_list = $giftcard_model->getGiftcardDetailList([
[ 'site_id', '=', $this->site_id ],
[ 'status', '=', 1 ],
[ 'is_delete', '=', '0' ],
[ 'card_type', '=', 'virtual' ],
], '*', 'sort desc');
foreach ($list[ 'data' ] as $k => $v) {
$list[ 'data' ][ $k ][ 'giftcard_list' ] = [];
foreach ($giftcard_list[ 'data' ] as $key => $val) {
if ($val[ 'category_id' ] == $v[ 'category_id' ]) {
$list[ 'data' ][ $k ][ 'giftcard_list' ][] = $val;
}
}
if (empty($list[ 'data' ][ $k ][ 'giftcard_list' ])) unset($list[ 'data' ][ $k ]);
ksort($list[ 'data' ]);
}
return $this->response($list);
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\giftcard\GiftCard as GiftCardModel;
use addon\giftcard\model\giftcard\Media;
use app\api\controller\BaseApi;
use app\model\shop\Shop;
/**
* 礼品卡
*/
class GiftcardRecords extends BaseApi
{
/**
* 列表信息
*/
public function lists()
{
$card_type = $this->params['card_type'] ?? '';
$page = $this->params['page'] ?? 1;
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
$search_text = $this->params['search_text'] ?? '';
$category_id = $this->params['category_id'] ?? 0;
$condition = array (
[ 'site_id', '=', $this->site_id ],
[ 'status', '', '1' ]
);
if (!empty($search_text)) {
$condition[] = [ 'card_name', 'like', '%' . $search_text . '%' ];
}
if (!empty($card_type)) {
$condition[] = [ 'card_type', '=', $card_type ];
}
if ($category_id > 0) {
$condition[] = [ 'category_id', '=', $category_id ];
}
$giftcard_model = new GiftCardModel();
$list = $giftcard_model->getGiftcardDetailPageList($condition, $page, $page_size, 'sort desc');
return $this->response($list);
}
/**
* 活动详情
*/
public function detail()
{
$giftcard_id = $this->params['giftcard_id'] ?? 0;
$giftcard_model = new GiftCardModel();
$media_model = new Media();
$detail = $giftcard_model->getGiftcardDetail([ 'giftcard_id' => $giftcard_id, 'site_id' => $this->site_id ])[ 'data' ] ?? [];
$detail[ 'media_list' ] = $media_model->getList([ [ 'media_id', 'in', $detail[ 'media_ids' ] ] ])[ 'data' ] ?? [];
$detail[ 'mobile' ] = ( new Shop() )->getShopInfo([ [ 'site_id', '=', $this->site_id ] ], 'mobile')[ 'data' ][ 'mobile' ] ?? '';
$detail[ 'giftcard_desc' ] = $giftcard_model->giftcardDesc($detail) ?? '';
return $this->response($this->success($detail));
}
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* Index.php
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
* @author : niuteam
* @date : 2022.8.8
* @version : v5.0.0.1
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\ordercreate\GiftcardOrderCreate as OrderCreateModel;
use app\api\controller\BaseOrderCreateApi;
/**
* 订单创建
*
*/
class Giftcardordercreate extends BaseOrderCreateApi
{
/**
* 创建订单
*/
public function create()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_create = new OrderCreateModel();
$data = [
'order_key' => $this->params['order_key'] ?? '',
];
$res = $order_create->setParam(array_merge($data, $this->getInputParam(), $this->getCommonParam(), $this->getDeliveryParam(), $this->getInvoiceParam()))->create();
return $this->response($res);
}
/**
* 计算信息
*/
public function calculate()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_create = new OrderCreateModel();
$data = [
'order_key' => $this->params['order_key'] ?? '',
];
$res = $order_create->setParam(array_merge($data, $this->getCommonParam(), $this->getDeliveryParam(), $this->getInvoiceParam()))->confirm();
return $this->response($this->success($res));
}
/**
* 待支付订单 数据初始化
* @return string
*/
public function payment()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_create = new OrderCreateModel();
$data = [
'member_card_id' => $this->params[ 'member_card_id' ] ?? 0,//组合套餐id
'goods_sku_list' => !empty($this->params[ 'goods_sku_list' ]) ? json_decode($this->params[ 'goods_sku_list' ], true) : [],
];
if (!$data[ 'member_card_id' ] && !$data[ 'goods_sku_list' ]) return $this->response($this->error('', '缺少必填参数商品数据'));
$res = $order_create->setParam(array_merge($data, $this->getCommonParam(), $this->getDeliveryParam()))->orderPayment();
return $this->response($this->success($res));
}
}

View File

@@ -0,0 +1,150 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\giftcard\GiftCard as GiftCardModel;
use addon\giftcard\model\membercard\MemberCard as MemberCardModel;
use addon\giftcard\model\membercard\Poster;
use addon\giftcard\model\transfer\Blessing;
use app\api\controller\BaseApi;
use app\model\shop\Shop;
use addon\giftcard\model\card\CardUse as CardUseModel;
/**
* 礼品卡
*/
class Membercard extends BaseApi
{
/**
* 列表信息
*/
public function lists()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$page = $this->params[ 'page' ] ?? 1;
$page_size = $this->params[ 'page_size' ] ?? PAGE_LIST_ROWS;
$is_transfer = $this->params[ 'is_transfer' ] ?? 'all';
$status = $this->params[ 'status' ] ?? 'all';
$source = $this->params[ 'source' ] ?? 'all';
$order = $this->params[ 'order' ] ?? 'get_time';
$order_id = $this->params[ 'order_id' ] ?? 0;
$condition = array (
[ 'gc.site_id', '=', $this->site_id ],
[ 'gmc.member_id', '=', $this->member_id ]
);
if ($status != 'all') {
$condition[] = [ 'gc.status', '=', $status ];
}
if ($is_transfer != 'all') {
$condition[] = [ 'gmc.is_transfer', '=', $is_transfer ];
}
if ($source != 'all') {
$condition[] = [ 'gmc.source', '=', $source ];
}
if (!empty($order_id)) {
$condition[] = [ 'gc.order_id', '=', $order_id ];
$condition[] = [ 'gmc.source', '=', 'order' ];
}
$member_card_model = new MemberCardModel();
$order_by = 'gmc.' . $order . ' desc';
$list = $member_card_model->getMemberCardDetailPageList($condition, $page, $page_size, $order_by);
return $this->response($list);
}
/**
* 活动详情
*/
public function detail()
{
$token = $this->checkToken();
// if ($token['code'] < 0) return $this->response($token);
$member_card_id = $this->params[ 'member_card_id' ] ?? 0;
$member_card_model = new MemberCardModel();
$params = array (
'site_id' => $this->site_id,
// 'member_id' => $this->member_id,
'member_card_id' => $member_card_id
);
$detail = $member_card_model->getMemberCardDetail($params)[ 'data' ] ?? [];
if (!empty($detail)) {
$detail[ 'is_self' ] = $detail[ 'member_id' ] == $this->member_id ? 1 : 0;
$detail[ 'mobile' ] = ( new Shop() )->getShopInfo([ [ 'site_id', '=', $this->site_id ] ], 'mobile')[ 'data' ][ 'mobile' ] ?? '';
$giftcard_model = new GiftCardModel();
$giftcard_info = $giftcard_model->getGiftcardInfo([ [ 'giftcard_id', '=', $detail[ 'giftcard_id' ] ] ], 'instruction')[ 'data' ] ?? [];
$detail[ 'giftcard_desc' ] = $giftcard_model->giftcardDesc($detail) ?? '';
$detail[ 'instruction' ] = $giftcard_info[ 'instruction' ] ?? '';
if ($detail[ 'status' ] == 'used') {
$card_use_model = new CardUseModel();
$card_use_condition = array (
[ 'card_id', '=', $detail[ 'card_id' ] ]
);
$card_use_info = $card_use_model->getCardUseRecordsInfo($card_use_condition, 'order_id')[ 'data' ] ?? [];
if (!empty($card_use_info)) {
$detail[ 'use_order_id' ] = $card_use_info[ 'order_id' ];
}
}
if ($detail[ 'to_member_id' ] > 0) {
$blessing_model = new Blessing();
$blessing_info = $blessing_model->getMemberCardBlessingInfo([ [ 'card_id', '=', $detail[ 'card_id' ] ], [ 'to_member_id', '=', $detail[ 'to_member_id' ] ] ], 'blessing')[ 'data' ] ?? [];
$detail[ 'blessing' ] = $blessing_info[ 'blessing' ] ?? '';
}
}
return $this->response($this->success($detail));
}
/**
* 祝福
* @return false|string
*/
public function blessing()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$member_card_id = $this->params[ 'member_card_id' ] ?? 0;
$blessing = $this->params[ 'blessing' ] ?? '';
$blessing_model = new Blessing();
$params = array (
'blessing' => $blessing,
'member_id' => $this->member_id,
'member_card_id' => $member_card_id,
'site_id' => $this->site_id
);
$result = $blessing_model->blessing($params);
return $this->response($result);
}
/**
* 获取商品海报
*/
public function poster()
{
$this->checkToken();
$promotion_type = 'giftcard';
$qrcode_param = json_decode($this->params[ 'qrcode_param' ], true);
$qrcode_param[ 'source_member' ] = $this->member_id;
$poster = new Poster();
$res = $poster->poster($this->params[ 'app_type' ], $this->params[ 'page' ], $qrcode_param, $promotion_type, $this->site_id);
return $this->response($res);
}
}

View File

@@ -0,0 +1,105 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\card\Card;
use addon\giftcard\model\order\GiftCardOrder;
use addon\giftcard\model\order\GiftCardOrderOperation;
use app\api\controller\BaseApi;
/**
* 礼品卡订单
*/
class Order extends BaseApi
{
/**
* 列表信息
*/
public function lists()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$card_type = $this->params['card_type'] ?? '';
$page = $this->params['page'] ?? 1;
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
$search_text = $this->params['search_text'] ?? '';
$order_status = $this->params['order_status'] ?? 'all';
$condition = array (
[ 'site_id', '=', $this->site_id ],
[ 'member_id', '=', $this->member_id ],
);
if (!empty($search_text)) {
$condition[] = [ 'card_name', 'like', '%' . $search_text . '%' ];
}
if (!empty($card_type)) {
$condition[] = [ 'card_type', '=', $card_type ];
}
if ($order_status != 'all') {
$condition[] = [ 'order_status', '=', $order_status ];
}
$order_model = new GiftCardOrder();
$field = 'order_id,num,order_no,site_id,site_name,order_name,out_trade_no,giftcard_id,card_right_type,card_cover,media_id,order_money,goods_money,pay_money,pay_type,pay_type_name,create_time,pay_time,order_status,member_id,order_from,order_from_name,close_cause,buyer_message,card_price';
$list = $order_model->getOrderDetailPageList($condition, $page, $page_size, 'order_id desc', $field);
return $this->response($list);
}
/**
* 活动详情
*/
public function detail()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_id = $this->params['order_id'] ?? '';
if (empty($order_id)) {
return $this->response($this->error('', 'REQUEST_ORDER_ID'));
}
$order_model = new GiftCardOrder();
$info = $order_model->getOrderDetail([ 'site_id' => $this->site_id, 'member_id' => $this->member_id, 'order_id' => $order_id ])[ 'data' ] ?? [];
if (!empty($info)) {
$card_model = new Card();
$card_list = $card_model->getCardList([ [ 'c.order_id', '=', $order_id ], [ 'c.member_id', '=', $this->member_id ] ], 'c.*,mc.member_card_id', '', 'c', [
[ 'giftcard_member_card mc', 'c.card_id=mc.card_id', 'left' ]
])[ 'data' ] ?? [];
$info[ 'card_list' ] = $card_list;
}
return $this->response($this->success($info));
}
/**
* 订单关闭
*/
public function close()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_id = $this->params['order_id'] ?? '';
if (empty($order_id)) {
return $this->response($this->error('', 'REQUEST_ORDER_ID'));
}
$order_model = new GiftCardOrderOperation();
$res = $order_model->close([
'site_id' => $this->site_id,
'order_id' => $order_id
]);
return $this->response($res);
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* Index.php
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
* @author : niuteam
* @date : 2022.8.8
* @version : v5.0.0.1
*/
namespace addon\giftcard\api\controller;
use app\api\controller\BaseApi;
use addon\giftcard\model\order\GiftCardOrderCreate as OrderCreateModel;
/**
* 订单创建
* @author Administrator
*
*/
class Ordercreate extends BaseApi
{
/**
* 创建订单
*/
public function create()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_create = new OrderCreateModel();
$data = [
'giftcard_id' => $this->params[ 'giftcard_id' ] ?? 0,//礼包id
'num' => $this->params[ 'num' ] ?? 1,//商品数量(买几套)
'media_id' => $this->params[ 'media_id' ] ?? 0,
'card_cover' => $this->params[ 'card_cover' ] ?? '',
'site_id' => $this->site_id,//站点id
'member_id' => $this->member_id,
'order_from' => $this->params[ 'app_type' ],
'order_from_name' => $this->params[ 'app_type_name' ],
'buyer_message' => $this->params[ 'buyer_message' ] ?? '',
];
if (empty($data[ 'giftcard_id' ])) {
return $this->response($this->error('', '缺少必填参数商品数据'));
}
$res = $order_create->create($data);
return $this->response($res);
}
/**
* 计算信息
*/
public function calculate()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$order_create = new OrderCreateModel();
$data = [
'giftcard_id' => $this->params[ 'giftcard_id' ] ?? 0,//礼包id
'num' => $this->params[ 'num' ] ?? 1,//商品数量(买几套)
'media_id' => $this->params[ 'media_id' ] ?? 0,
'card_cover' => $this->params[ 'card_cover' ] ?? '',
'site_id' => $this->site_id,//站点id
'member_id' => $this->member_id,
'order_from' => $this->params[ 'app_type' ],
'order_from_name' => $this->params[ 'app_type_name' ],
'buyer_message' => $this->params[ 'buyer_message' ] ?? '',
];
if (empty($data[ 'giftcard_id' ])) {
return $this->response($this->error('', '缺少必填参数商品数据'));
}
$res = $order_create->calculate($data);
return $this->response($res);
}
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\giftcard\api\controller;
use addon\giftcard\model\transfer\Blessing;
use addon\giftcard\model\transfer\Transfer as TransferModel;
use app\api\controller\BaseApi;
/**
* 礼品卡
*/
class Transfer extends BaseApi
{
/**
* 转赠
*/
public function transfer()
{
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$no = $this->params[ 'no' ] ?? '';
$blessing_model = new Blessing();
$info = $blessing_model->getMemberCardBlessingInfo([ [ 'no', '=', $no ] ])[ 'data' ] ?? [];
$transfer_model = new TransferModel();
$params = array (
'site_id' => $this->site_id,
'member_id' => $this->member_id,
'blessing_id' => $info[ 'blessing_id' ] ?? 0
);
$result = $transfer_model->transfer($params);
return $this->response($result);
}
public function blessingDetail()
{
$token = $this->checkToken();
// if ($token['code'] < 0) return $this->response($token);
$no = $this->params[ 'no' ] ?? '';
$blessing_model = new Blessing();
$params = array (
'site_id' => $this->site_id,
'no' => $no,
'member_id' => $this->member_id
);
$result = $blessing_model->getBlessingDetail($params);
return $this->response($result);
}
}