mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	feat: refactoring adjustments for member pages
This commit is contained in:
		@@ -79,7 +79,7 @@ func (js *PayJS) Pay(param JPayReq) JPayReps {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (js *PayJS) sign(params url.Values) string {
 | 
			
		||||
	params.Del(`Sign`)
 | 
			
		||||
	params.Del(`sign`)
 | 
			
		||||
	var keys = make([]string, 0, 0)
 | 
			
		||||
	for key := range params {
 | 
			
		||||
		if params.Get(key) != `` {
 | 
			
		||||
@@ -109,7 +109,7 @@ func (js *PayJS) Check(tradeNo string) error {
 | 
			
		||||
	apiURL := fmt.Sprintf("%s/api/check", js.config.ApiURL)
 | 
			
		||||
	params := url.Values{}
 | 
			
		||||
	params.Add("payjs_order_id", tradeNo)
 | 
			
		||||
	params.Add("Sign", js.sign(params))
 | 
			
		||||
	params.Add("sign", js.sign(params))
 | 
			
		||||
	data := strings.NewReader(params.Encode())
 | 
			
		||||
	resp, err := http.Post(apiURL, "application/x-www-form-urlencoded", data)
 | 
			
		||||
	defer resp.Body.Close()
 | 
			
		||||
@@ -135,6 +135,7 @@ func (js *PayJS) Check(tradeNo string) error {
 | 
			
		||||
	if r.ReturnCode == 1 && r.Status == 1 {
 | 
			
		||||
		return nil
 | 
			
		||||
	} else {
 | 
			
		||||
		logger.Errorf("PayJs 支付验证响应:%s", string(body))
 | 
			
		||||
		return errors.New("order not paid")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -110,7 +110,7 @@ func OpenAIRequest(db *gorm.DB, prompt string) (string, error) {
 | 
			
		||||
	r, err := client.R().SetHeader("Content-Type", "application/json").
 | 
			
		||||
		SetHeader("Authorization", "Bearer "+apiKey.Value).
 | 
			
		||||
		SetBody(types.ApiRequest{
 | 
			
		||||
			Model:       "gpt-3.5-turbo",
 | 
			
		||||
			Model:       "gpt-3.5-turbo-0125",
 | 
			
		||||
			Temperature: 0.9,
 | 
			
		||||
			MaxTokens:   1024,
 | 
			
		||||
			Stream:      false,
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,6 @@
 | 
			
		||||
  background-color: #393f4a;
 | 
			
		||||
  color: #fff;
 | 
			
		||||
  border-radius: 10px;
 | 
			
		||||
  height: 100vh;
 | 
			
		||||
}
 | 
			
		||||
.member .inner .user-profile .el-form-item__label {
 | 
			
		||||
  color: #fff;
 | 
			
		||||
@@ -130,7 +129,7 @@
 | 
			
		||||
.member .inner .product-box .list-box .product-item .product-info .info-line .expire {
 | 
			
		||||
  color: #409eff;
 | 
			
		||||
}
 | 
			
		||||
.member .inner .product-box .list-box .product-item .product-info .info-line .calls {
 | 
			
		||||
.member .inner .product-box .list-box .product-item .product-info .info-line .power {
 | 
			
		||||
  color: #f2cb51;
 | 
			
		||||
}
 | 
			
		||||
.member .inner .product-box .list-box .product-item .product-info .pay-way {
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@
 | 
			
		||||
      background-color #393F4A
 | 
			
		||||
      color #ffffff
 | 
			
		||||
      border-radius 10px
 | 
			
		||||
      height 100vh
 | 
			
		||||
      //height 100vh
 | 
			
		||||
 | 
			
		||||
      .el-form-item__label {
 | 
			
		||||
        color #ffffff
 | 
			
		||||
@@ -162,7 +162,7 @@
 | 
			
		||||
                color #409eff
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              .calls {
 | 
			
		||||
              .power {
 | 
			
		||||
                color #F2CB51
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <!-- 倒计时组件 -->
 | 
			
		||||
  <div class="countdown">
 | 
			
		||||
    <el-tag size="large" :type="type">{{ timerStr }}</el-tag>
 | 
			
		||||
    <el-tag size="large" type="info">{{ timerStr }}</el-tag>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<script setup>
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
            <span>{{ scope.row.remark?.power }}</span>
 | 
			
		||||
          </template>
 | 
			
		||||
        </el-table-column>
 | 
			
		||||
 | 
			
		||||
        <el-table-column prop="pay_way" label="支付方式"/>
 | 
			
		||||
        <el-table-column label="支付时间">
 | 
			
		||||
          <template #default="scope">
 | 
			
		||||
            <span v-if="scope.row['pay_time']">{{ dateFormat(scope.row['pay_time']) }}</span>
 | 
			
		||||
@@ -56,7 +56,7 @@ import Clipboard from "clipboard";
 | 
			
		||||
const items = ref([])
 | 
			
		||||
const total = ref(0)
 | 
			
		||||
const page = ref(1)
 | 
			
		||||
const pageSize = ref(10)
 | 
			
		||||
const pageSize = ref(12)
 | 
			
		||||
const loading = ref(true)
 | 
			
		||||
 | 
			
		||||
onMounted(() => {
 | 
			
		||||
 
 | 
			
		||||
@@ -34,8 +34,9 @@
 | 
			
		||||
        <el-col :span="17">
 | 
			
		||||
          <div class="product-box">
 | 
			
		||||
            <div class="info" v-if="orderPayInfoText !== ''">
 | 
			
		||||
              <el-alert type="info" show-icon :closable="false" effect="dark">
 | 
			
		||||
                <strong>说明:</strong> {{ orderPayInfoText }}
 | 
			
		||||
              <el-alert type="success" show-icon :closable="false" effect="dark">
 | 
			
		||||
                <strong>说明:</strong> 月度会员,年度会员每月赠送 {{ vipMonthPower }} 点算力,赠送算力当月有效,当月没有消费完的算力不结余到下个月。
 | 
			
		||||
                点卡充值的算力长期有效。
 | 
			
		||||
              </el-alert>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
@@ -64,15 +65,9 @@
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="info-line">
 | 
			
		||||
                      <span class="label">对话次数:</span>
 | 
			
		||||
                      <span class="calls" v-if="scope.item.calls > 0">{{ scope.item.calls }}</span>
 | 
			
		||||
                      <span class="calls" v-else>{{ vipMonthCalls }}</span>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="info-line">
 | 
			
		||||
                      <span class="label">绘图次数:</span>
 | 
			
		||||
                      <span class="calls" v-if="scope.item.img_calls > 0">{{ scope.item.img_calls }}</span>
 | 
			
		||||
                      <span class="calls" v-else>{{ vipMonthImgCalls }}</span>
 | 
			
		||||
                      <span class="label">算力值:</span>
 | 
			
		||||
                      <span class="power" v-if="scope.item.power > 0">{{ scope.item.power }}</span>
 | 
			
		||||
                      <span class="power" v-else>{{ vipMonthPower }}</span>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="pay-way">
 | 
			
		||||
@@ -121,9 +116,9 @@
 | 
			
		||||
        title="参与众筹"
 | 
			
		||||
    >
 | 
			
		||||
      <el-alert type="info" :closable="false">
 | 
			
		||||
        <div style="font-size: 14px">您好,众筹 9.9元,就可以兑换 100 次对话,以此来覆盖我们的 OpenAI
 | 
			
		||||
          账单和服务器的费用。<strong
 | 
			
		||||
              style="color: #f56c6c">由于本人没有开通微信支付,付款后请凭借转账单号,点击【众筹核销】按钮手动核销。</strong>
 | 
			
		||||
        <div style="font-size: 14px">您好,目前每单位算力众筹价格为 <strong style="color: #f56c6c">{{ powerPrice }}
 | 
			
		||||
        </strong>元。
 | 
			
		||||
          由于本人没有开通微信支付,付款后请凭借转账单号,点击【众筹核销】按钮手动核销。
 | 
			
		||||
        </div>
 | 
			
		||||
      </el-alert>
 | 
			
		||||
      <div style="text-align: center;padding-top: 10px;">
 | 
			
		||||
@@ -137,9 +132,8 @@
 | 
			
		||||
        :show-close="true"
 | 
			
		||||
        :width="400"
 | 
			
		||||
        @close="closeOrder"
 | 
			
		||||
        title="充值订单支付">
 | 
			
		||||
        :title="'实付金额:¥'+amount">
 | 
			
		||||
      <div class="pay-container">
 | 
			
		||||
        <h3 class="amount">实付金额:<span>¥{{ amount }}</span></h3>
 | 
			
		||||
        <div class="count-down">
 | 
			
		||||
          <count-down :second="orderTimeout" @timeout="refreshPayCode" ref="countDownRef"/>
 | 
			
		||||
        </div>
 | 
			
		||||
@@ -205,8 +199,8 @@ const countDownRef = ref(null)
 | 
			
		||||
const orderTimeout = ref(1800)
 | 
			
		||||
const loading = ref(true)
 | 
			
		||||
const orderPayInfoText = ref("")
 | 
			
		||||
const vipMonthCalls = ref(0)
 | 
			
		||||
const vipMonthImgCalls = ref(0)
 | 
			
		||||
const vipMonthPower = ref(0)
 | 
			
		||||
const powerPrice = ref(0)
 | 
			
		||||
 | 
			
		||||
const payWays = ref({})
 | 
			
		||||
const amount = ref(0)
 | 
			
		||||
@@ -234,8 +228,8 @@ onMounted(() => {
 | 
			
		||||
    if (res.data['order_pay_timeout'] > 0) {
 | 
			
		||||
      orderTimeout.value = res.data['order_pay_timeout']
 | 
			
		||||
    }
 | 
			
		||||
    vipMonthCalls.value = res.data['vip_month_calls']
 | 
			
		||||
    vipMonthImgCalls.value = res.data['vip_month_img_calls']
 | 
			
		||||
    vipMonthPower.value = res.data['vip_month_power']
 | 
			
		||||
    powerPrice.value = res.data['power_price']
 | 
			
		||||
  }).catch(e => {
 | 
			
		||||
    ElMessage.error("获取系统配置失败:" + e.message)
 | 
			
		||||
  })
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user