权益商城系统源码 现支持多种支付方式

权益商城系统源码支持多种支付方式,后台商品管理,订单管理,串货管理,分站管理,会员列表,分销日志,应用配置。

上传到服务器,修改数据库信息,导入数据库,即可账号密码:123456L

部分主要源码,想看写好的请坐飞机:权益商城系统源码 现支持多种支付方式-资源吧

namespace leadmall\app;
 
use basics\app\BasicsController as BasicsModules;
use leadmall\Map;
use Yii;
 
class PosterController extends BasicsModules implements Map
{
    public $user_info = [];
    /**
     * 重写父类
     * @return [type] [description]
     */
    public function actions()
    {
        $actions = parent::actions();
        unset($actions['create']);
        unset($actions['update']);
        return $actions;
    }
 
    /**
     * 处理海报生成
     * @param  string $value [description]
     * @return [type]        [description]
     */
    public function actionIndex()
    {
        $type     = Yii::$app->request->get('type', 1);
        $goods_id = Yii::$app->request->get('goods_id', false);
        $is_task  = Yii::$app->request->get('is_task', false);
        $scene    = '';
        if (!empty(Yii::$app->user->identity)) {
            $model           = M('users', 'User')::findOne(Yii::$app->user->identity->id);
            $this->user_info = $model;
            if ($model) {
                $promoter = $model->promoter;
                if ($promoter && $promoter->status == 2) {
                    $scene = 'spu=' . $model->id; //spu为share_promoter_uid缩写
                }
            }
        }
 
        if ($is_task == "false") {
            $is_task = false;
        }
 
        if ($goods_id && $is_task == false) {
            return $this->goods($type, $goods_id, $scene);
        }
 
        if ($goods_id && ($is_task || $is_task == 'true')) {
            return $this->goodstask($type, $goods_id, $scene);
        }
 
        $coupon_id = Yii::$app->request->get('coupon_id', false);
        if ($coupon_id) {
            return $this->coupon($type, $coupon_id, $scene);
        }
 
        $store = Yii::$app->request->get('store', false);
        if ($store == 1) {
            return $this->store($type, $scene);
        }
 
        $invitation = Yii::$app->request->get('invitation', false);
        if ($invitation == 1) {
            return $this->invitation($type, $scene);
        }
 
        $zoom = Yii::$app->request->get('zoom', false);
        if ($zoom == 1) {
            return $this->zoom($type, $scene);
        }
 
    }
 
    public function zoom($type, $scene)
    {
        $UID   = Yii::$app->request->get('UID', false);
        $UID   = $UID ? $UID : $this->user_info->id;
        $scene = $scene && $scene != 'index' ? '&' . $scene : '';
 
        $dynamic = StoreSetting('promoter_page_setting', 'dynamic');
        if ($dynamic && $dynamic['bg_url']) {
            $dynamic_url = $dynamic['bg_url'];
        } else {
            $dynamic_url = realpath('../system/static/promoter_zoom_banner.png');
        }
 
        $box         = imagettfbbox(32, 0, realpath('../system/static/PingFang.ttf'), $this->user_info->nickname);
        $text_length = $box[2] - $box[0];
 
        //图片转换
        $config = array(
            'text'       => array(
                array(
                    'text'      => $this->user_info->nickname,
                    'left'      => 375 - ($text_length / 2),
                    'top'       => 540,
                    'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                    'fontSize'  => 32, //字号
                    'fontColor' => '34,34,34', //字体颜色
                    'angle'     => 0,
                    'lineation' => 0,
                ),
                array(
                    'text'      => $type == 1 ? '长按识别二维码' : '长按识别小程序码',
                    'left'      => $type == 1 ? 298 : 288,
                    'top'       => 920,
                    'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                    'fontSize'  => 16, //字号
                    'fontColor' => '153,153,153', //字体颜色
                    'angle'     => 0,
                    'lineation' => 0,
                ),
 
            ),
            'image'      => array(
                array(
                    'url'     => $dynamic_url,
                    'left'    => 70,
                    'top'     => 72,
                    'right'   => 0,
                    'stream'  => 0,
                    'bottom'  => 0,
                    'width'   => 608,
                    'height'  => 304,
                    'opacity' => 100,
                    'radius'  => 16,
                    'color'   => '255, 255, 255',
                ),
                array(
                    'url'     => $this->user_info->avatar,
                    'left'    => 295,
                    'top'     => 324,
                    'right'   => 0,
                    'stream'  => 0,
                    'bottom'  => 0,
                    'width'   => 160,
                    'height'  => 160,
                    'opacity' => 100,
                    'radius'  => 80,
                    'color'   => '255, 255, 255',
                ),
                //二维码
                array(
                    'url'     => $type == 1 ? $this->getWechatQrCode("promoter/pages/dynamic", "UID=" . $UID . $scene) : $this->getWeappQrCode("promoter/pages/dynamic", "UID=" . $UID . $scene),
                    'left'    => 285,
                    'top'     => 712,
                    'right'   => 0,
                    'stream'  => 1,
                    'bottom'  => 0,
                    'width'   => 180,
                    'height'  => 180,
                    'opacity' => 100,
                    'radius'  => 0,
                    'color'   => '255, 255, 255',
                ),
            ),
            'background' => realpath('../system/static/promoter_zoom_bg.png'),
        );
        //createPoster($config);
        ob_start();
        echo createPoster($config);
        $imagedata = ob_get_contents();
        ob_end_clean();
        return 'data:image/png;base64,' . base64_encode($imagedata);
    }
 
    public function invitation($type, $scene)
    {
        $scene       = $scene && $scene != 'index' ? '&' . $scene : '';
        $box         = imagettfbbox(32, 0, realpath('../system/static/PingFang.ttf'), $this->user_info->nickname);
        $text_length = $box[2] - $box[0];
        //图片转换
        $config = array(
            'text'       => array(
                array(
                    'text'      => $this->user_info->nickname,
                    'left'      => 375 - ($text_length / 2),
                    'top'       => 545,
                    'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                    'fontSize'  => 32, //字号
                    'fontColor' => '34,34,34', //字体颜色
                    'angle'     => 0,
                    'lineation' => 0,
                ),
                array(
                    'text'      => $type == 1 ? '长按识别二维码' : '长按识别小程序码',
                    'left'      => $type == 1 ? 298 : 288,
                    'top'       => 920,
                    'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                    'fontSize'  => 16, //字号
                    'fontColor' => '153,153,153', //字体颜色
                    'angle'     => 0,
                    'lineation' => 0,
                ),
 
            ),
            'image'      => array(
                array(
                    'url'     => $this->user_info->avatar,
                    'left'    => 295,
                    'top'     => 324,
                    'right'   => 0,
                    'stream'  => 0,
                    'bottom'  => 0,
                    'width'   => 160,
                    'height'  => 160,
                    'opacity' => 100,
                    'radius'  => 80,
                    'color'   => '255, 255, 255',
                ),
                //二维码
                array(
                    'url'     => $type == 1 ? $this->getWechatQrCode("promoter/pages/recruit", "invite_id=" . $this->user_info->id . $scene) : $this->getWeappQrCode("promoter/pages/recruit", "invite_id=" . $this->user_info->id . $scene),
                    'left'    => 285,
                    'top'     => 712,
                    'right'   => 0,
                    'stream'  => 1,
                    'bottom'  => 0,
                    'width'   => 180,
                    'height'  => 180,
                    'opacity' => 100,
                    'radius'  => 0,
                    'color'   => '255, 255, 255',
                ),
            ),
            'background' => realpath('../system/static/invitation_bg.png'),
        );
        //createPoster($config);
        ob_start();
        echo createPoster($config);
        $imagedata = ob_get_contents();
        ob_end_clean();
        return 'data:image/png;base64,' . base64_encode($imagedata);
    }
 
    public function store($type, $scene)
    {
        $store_setting = StoreSetting('setting_collection', 'store_setting');
        $box           = imagettfbbox(32, 0, realpath('../system/static/PingFang.ttf'), $store_setting['name']);
        $text_length   = $box[2] - $box[0];
        //图片转换
        $config = array(
            'text'       => array(
                array(
                    'text'      => $store_setting['name'],
                    'left'      => 375 - ($text_length / 2),
                    'top'       => 275,
                    'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                    'fontSize'  => 32, //字号
                    'fontColor' => '34,34,34', //字体颜色
                    'angle'     => 0,
                    'lineation' => 0,
                ),
                array(
                    'text'      => $type == 1 ? '长按识别二维码' : '长按识别小程序码',
                    'left'      => $type == 1 ? 298 : 288,
                    'top'       => 625,
                    'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                    'fontSize'  => 16, //字号
                    'fontColor' => '153,153,153', //字体颜色
                    'angle'     => 0,
                    'lineation' => 0,
                ),
 
            ),
            'image'      => array(
                array(
                    'url'     => $store_setting['logo'],
                    'left'    => 295,
                    'top'     => 32,
                    'right'   => 0,
                    'stream'  => 0,
                    'bottom'  => 0,
                    'width'   => 160,
                    'height'  => 160,
                    'opacity' => 100,
                    'radius'  => 80,
                    'color'   => '255, 255, 255',
                ),
                //二维码
                array(
                    'url'     => $type == 1 ? $this->getWechatQrCode("pages/index/index", $scene) : $this->getWeappQrCode("pages/index/index", $scene),
                    'left'    => 285,
                    'top'     => 418,
                    'right'   => 0,
                    'stream'  => 1,
                    'bottom'  => 0,
                    'width'   => 180,
                    'height'  => 180,
                    'opacity' => 100,
                    'radius'  => 0,
                    'color'   => '255, 255, 255',
                ),
            ),
            'background' => realpath('../system/static/store_bg.png'),
        );
        //createPoster($config);
        ob_start();
        echo createPoster($config);
        $imagedata = ob_get_contents();
        ob_end_clean();
        return 'data:image/png;base64,' . base64_encode($imagedata);
    }
 
    public function coupon($type, $coupon_id, $scene)
    {
        $model    = M('coupon', 'Coupon')::findOne($coupon_id);
 
        $setting_data = M('setting', 'Setting')::find()->where(['keyword' => 'setting_collection', 'merchant_id' => 1, 'AppID' => Yii::$app->params['AppID']])->select('content')->asArray()->one();
 
        $setting_data = to_array($setting_data['content']);
        $setting_data = str2url($setting_data);
 
        if ($model) {
            $model = $model->toArray();
 
            if ($model['expire_type'] == 1) {
                $time = '可用时间:领取当日起' . $model['expire_day'] . '天内';
            } else {
                $time = '可用时间:' . date("Y.m.d", $model['begin_time']) . ' - ' . date("Y.m.d", $model['end_time']);
            }
 
            $scene = $scene && $scene != 'index' ? '&' . $scene : '';
 
            //图片转换
            $config = array(
                'text'       => array(
                    array(
                        'text'      => $setting_data['store_setting']['name'],
                        'left'      => 189,
                        'top'       => 120,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 20, //字号
                        'fontColor' => '34,34,34', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => '送你一张优惠券',
                        'left'      => 190,
                        'top'       => 150,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 16, //字号
                        'fontColor' => '153,153,153', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => '¥',
                        'left'      => 150,
                        'top'       => 270,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 22, //字号
                        'fontColor' => '255,255,255', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => $model['min_price'] * 1 > 0 ? '满' . $model['min_price'] . '可用' : '无门槛',
                        'left'      => 168 + (mb_strlen($model['sub_price']) * 28),
                        'top'       => 265,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 22, //字号
                        'fontColor' => '255,255,255', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => $model['sub_price'],
                        'left'      => 168,
                        'top'       => 265,
                        'fontPath'  => realpath('../system/static/DINPro.ttf'), //字体文件
                        'fontSize'  => 40, //字号
                        'fontColor' => '255,255,255', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => $model['name'],
                        'left'      => 149,
                        'top'       => 315,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 24, //字号
                        'fontColor' => '255,255,255', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => $time,
                        'left'      => 149,
                        'top'       => 355,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 15, //字号
                        'fontColor' => '255,255,255', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
                    array(
                        'text'      => $type == 1 ? '长按识别二维码' : '长按识别小程序码',
                        'left'      => $type == 1 ? 305 : 295,
                        'top'       => 735,
                        'fontPath'  => realpath('../system/static/PingFang.ttf'), //字体文件
                        'fontSize'  => 16, //字号
                        'fontColor' => '153,153,153', //字体颜色
                        'angle'     => 0,
                        'lineation' => 0,
                    ),
 
                ),
                'image'      => array(
                    array(
                        'url'     => $setting_data['store_setting']['logo'],
                        'left'    => 101,
                        'top'     => 96,
                        'right'   => 0,
                        'stream'  => 0,
                        'bottom'  => 0,
                        'width'   => 64,
                        'height'  => 64,
                        'opacity' => 100,
                        'radius'  => 32,
                        'color'   => '255, 255, 255',
                    ),
                    //二维码
                    array(
                        'url'     => $type == 1 ? $this->getWechatQrCode("pages/coupon/detail", "couponShare=1&id=" . $model['id'] . $scene) : $this->getWeappQrCode("pages/coupon/detail", "couponShare=1&id=" . $model['id'] . $scene),
                        'left'    => 285,
                        'top'     => 508,
                        'right'   => 0,
                        'stream'  => 1,
                        'bottom'  => 0,
                        'width'   => 190,
                        'height'  => 190,
                        'opacity' => 100,
                        'radius'  => 0,
                        'color'   => '255, 255, 255',
                    ),
                ),
                'background' => 'http://qmxq.oss-cn-hangzhou.aliyuncs.com/guide/coupon_bg.png',
            );
            //createPoster($config);
            ob_start();
            echo createPoster($config);
            $imagedata = ob_get_contents();
            ob_end_clean();
            return 'data:image/png;base64,' . base64_encode($imagedata);
        } else {
            Error('优惠券不存在');
        }
    }
 
    public function goodstask($type, $goods_id, $scene)
    {
        $model = M('goods', 'Goods')::find()
            ->joinWith('task')
            ->where(['goods_id' => $goods_id])
            ->asArray()
            ->one();
 
        $setting_data = M('setting', 'Setting')::find()->where(['keyword' => 'setting_collection', 'merchant_id' => 1, 'AppID' => Yii::$app->params['AppID']])->select('content')->asArray()->one();
 
        $setting_data = to_array($setting_data['content']);
        $setting_data = str2url($setting_data);
 
        $UID = 0;
        if (@Yii::$app->user->identity->id) {
            $UID = Yii::$app->user->identity->id;
        }

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Eric,会点编程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值