276 lines
26 KiB
Go
276 lines
26 KiB
Go
package main
|
||
|
||
import (
|
||
"flag"
|
||
"fmt"
|
||
"io"
|
||
"net/http"
|
||
"os"
|
||
"strconv"
|
||
"strings"
|
||
"time"
|
||
|
||
. "ciyon/zciyon"
|
||
)
|
||
|
||
func dbtran_test() {
|
||
x := 4
|
||
|
||
err := CiyDB.Tran(func() error {
|
||
Clog(x)
|
||
|
||
csql := NewCiySQL("o_user")
|
||
csql.Column("!name, memo")
|
||
row, total, err := CiyDB.Get(csql, -1)
|
||
if err != nil {
|
||
return err
|
||
}
|
||
_ = total
|
||
_ = row
|
||
field, fsort := CiyDB.GetField(csql)
|
||
Clog(field, fsort)
|
||
|
||
updata := map[string]any{
|
||
"name": []string{"name1"},
|
||
"memo": "memo",
|
||
}
|
||
CiyDB.Insert(csql, updata)
|
||
CiyDB.Delete(csql, CIYDB_DELETE_BACKUP_FIELD)
|
||
//_ = rett
|
||
|
||
return nil
|
||
})
|
||
Clog(err)
|
||
|
||
}
|
||
func dbrawsql_test() {
|
||
csql := NewCiySQL("o_user")
|
||
csql.RawSQL("select * from o_user where id>? and activetimes=?", 2, 0)
|
||
row, _, err := CiyDB.Get(csql)
|
||
Clog(row, err)
|
||
}
|
||
|
||
func dbst_test() { //压力测试
|
||
for {
|
||
go dbopst_test()
|
||
Sleep(0.001)
|
||
}
|
||
}
|
||
func dbopst_test() { //压力测试单元
|
||
csql := NewCiySQL("o_user")
|
||
cnt := Toint(CiyDB.Get1(csql))
|
||
if cnt < 4 {
|
||
Clog("Get1 error")
|
||
return
|
||
}
|
||
row, err := CiyDB.Getone(csql)
|
||
if err != nil {
|
||
Clog(err)
|
||
return
|
||
}
|
||
if row == nil {
|
||
Clog("没有数据")
|
||
return
|
||
}
|
||
|
||
csql.Column("!name, memo")
|
||
list, total, err := CiyDB.Get(csql, 0)
|
||
if err != nil {
|
||
Clog(err)
|
||
return
|
||
}
|
||
_ = total
|
||
for _, v := range list {
|
||
id := Getint(v, "id")
|
||
if id == 1 {
|
||
//Clog("id")
|
||
}
|
||
//Clog(v)
|
||
}
|
||
Clog("done")
|
||
}
|
||
func dbpool_test() {
|
||
db := CiyRouteDB.Takeout()
|
||
csql := NewCiySQL("o_user")
|
||
list, _, _ := db.Get(csql)
|
||
for _, v := range list {
|
||
Clog(v)
|
||
}
|
||
}
|
||
|
||
func str_test() {
|
||
//int float64 byte/uint8 rune/int32
|
||
mk := make([]int, 4, 6)
|
||
mk = append(mk, 1, 2)
|
||
mk = append(mk, 5)
|
||
mk = append(mk, 5)
|
||
mk = append(mk, 5)
|
||
mk = append(mk, 5)
|
||
Clog(mk, &mk)
|
||
Clog(os.Args)
|
||
var user string
|
||
flag.StringVar(&user, "u", "", "")
|
||
var post int
|
||
flag.IntVar(&post, "o", 3, "")
|
||
|
||
var ic uint32 = 4294967294
|
||
var chr byte = 'a'
|
||
ia := 12
|
||
go func() {
|
||
|
||
Clog("go func")
|
||
|
||
}()
|
||
|
||
arrx := []int{1, 2, 3, 2, 3}
|
||
arrx = append(arrx, 4)
|
||
Clog(arrx)
|
||
|
||
sl := arrx[1:3]
|
||
sl = append(sl, 7)
|
||
sl = append(sl, 8)
|
||
sl = append(sl, 9)
|
||
sl[0] = 222
|
||
Clog(sl)
|
||
Clog(arrx)
|
||
|
||
flt := float64(ic)
|
||
var a any = 2147483647.9
|
||
var b any = -223372036854775807
|
||
c, ok := a.(int32)
|
||
var str string = "123"
|
||
var d int = int(c)
|
||
|
||
Clog(a, b, c, ok, d, str, ic, ia, flt, chr)
|
||
Clog("%T", str)
|
||
|
||
for1:
|
||
for i := 0; i < 10; i++ {
|
||
for j := 0; j < 10; j++ {
|
||
if i == 5 && j == 5 {
|
||
break for1
|
||
}
|
||
Clog(i, j)
|
||
}
|
||
}
|
||
//Clog(data)
|
||
msg := "Ciyon众产"
|
||
// for i := 0; i < len(msg); i++ {
|
||
// Clog("len.index:%d,value:%c,hex:%d", i, msg[i], msg[i])
|
||
// }
|
||
// for i, value := range msg {
|
||
// Clog("rng.index:%d,value:%c,hex:%d", i, value, value)
|
||
// }
|
||
|
||
boo := strings.Contains(msg, "CIY")
|
||
n1, _ := strconv.Atoi("123")
|
||
n2 := strconv.Itoa(123)
|
||
|
||
Clog("Ciyon"+msg, n1, n2, boo)
|
||
}
|
||
|
||
func lineprint_test() {
|
||
//命令行最后一行重复覆盖输出。
|
||
for i := 0; i <= 50; i++ {
|
||
fmt.Print("\r" + strconv.Itoa(i) + "\tABCD")
|
||
time.Sleep(time.Microsecond * 100)
|
||
}
|
||
}
|
||
|
||
func json_test() {
|
||
|
||
var jsonstr string = `{"order":"id desc","pageno":1,"pagecount":50,"count":49,"data":[{"id":"20067","upid":"4","userid":"10917","typeorg":"45","shname":"","name":"\u5929\u534e\u91d1\u79d1\uff08\u5c71\u897f\uff09\u7269\u8054\u79d1\u6280\u6709\u9650\u516c\u53f8","uscc":"91149900MAD4DAQH73","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1710315513","dbpst":"","memo":"\u5929\u534e\u91d1\u79d1\u5b58\u8d271\u5e74","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20066","upid":"4","userid":"10890","typeorg":"10","shname":"","name":"\u53d9\u6c38\u53bf\u8302\u82bd\u517b\u6b96\u6709\u9650\u516c\u53f8","uscc":"92510524MA7KH88T0X","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1707295770","dbpst":"","memo":"\u6f14\u793a\u8d26\u53f7\uff0c\u52302\u6708\u5e95","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20065","upid":"4","userid":"10849","typeorg":"10","shname":"","name":"\u6d59\u6c5f\u4f70\u5e93\u52a8\u4ea7\u8d28\u62bc\u7ba1\u7406\u6709\u9650\u516c\u53f8","uscc":"91330183MACLFJN32X","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1704161545","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20064","upid":"4","userid":"4","typeorg":"40","shname":"","name":"A\u6f14\u793a-\u6d3b\u4f53\u62b5\u62bc\u76d1\u7ba1","uscc":"CP220502182291626R","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1703145355","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20063","upid":"4","userid":"10838","typeorg":"95","shname":"","name":"\u9648\u6676\u5bb6\u5ead\u519c\u573a","uscc":"CP2112221935T62112","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1702457362","dbpst":"","memo":"\u6276\u6301\u724820231213\u5f00\u4e00\u5e74","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20062","upid":"4","userid":"10313","typeorg":"45","shname":"","name":"\u5185\u8499\u53e4\u6c47\u878d\u5b58\u8d27\u76d1\u7ba1","uscc":"CM2310135625663238","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1696738225","dbpst":"","memo":"\u6c47\u878d-\u5b58\u8d27","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20061","upid":"4","userid":"4","typeorg":"30","shname":"","name":"A\u6f14\u793a-\u5b58\u8d27\u76d1\u7ba1","uscc":"CM2310135625633660","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1696596351","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20060","upid":"4","userid":"10756","typeorg":"10","shname":"","name":"\u4e4c\u5170\u54c8\u8fbe\u7164\u77ff\u725b\u573a","uscc":"91150622MA0MXDT4X3","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1693968832","dbpst":"","memo":"\u72ec\u7acb\u90e8\u7f72\u517b\u6b96\u573a\u901a\u7528+\u667a\u6167\u8033\u6807+\u89c6\u9891\u76d1\u63a7+\u7535\u5b50\u8033\u6807\u79fb\u52a8","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20059","upid":"4","userid":"10735","typeorg":"10","shname":"","name":"\u79f0\u591a\u53bf\u53d1\u5c55\u548c\u6539\u9769\u5c40","uscc":"11632723MB0U873771","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1692076122","dbpst":"","memo":"\u4e09\u6c5f\u6e90\u755c\u7267\u76d1\u7ba1\u5e73\u53f0","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20058","upid":"4","userid":"10718","typeorg":"10","shname":"","name":"\u5ef6\u5b89\u5e02\u5b89\u585e\u533a\u755c\u7267\u5c40","uscc":"12610624436540921R","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1690861365","dbpst":"","memo":"1\u4e07\u53ea","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20057","upid":"4","userid":"4","typeorg":"45","shname":"","name":"\u5929\u6d25\u5ec9\u4e30\u519c\u573a\u6709\u9650\u516c\u53f8","uscc":"91120221MABLTB1C9U","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1680247784","dbpst":"","memo":"\u9ed1\u5c71\u7f8a","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20056","upid":"0","userid":"10510","typeorg":"45","shname":"","name":"\u9646\u6cb3\u53bf\u8d85\u7f8e\u519c\u4e1a\u53d1\u5c55\u6709\u9650\u516c\u53f8","uscc":"91441523MA5304317X","areacode":"441523","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1675933993","dbpst":"","memo":"598\u4e00\u5e741K","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20055","upid":"0","userid":"4","typeorg":"45","shname":"","name":"\u4e0a\u6d77\u7d2b\u5c16\u6559\u80b2\u79d1\u6280\u6709\u9650\u516c\u53f8","uscc":"913101143121852513","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1671696007","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20054","upid":"0","userid":"10419","typeorg":"45","shname":"","name":"\u83cf\u6cfd\u4e1c\u660e\u53bf\u793a\u8303\u732a\u573a","uscc":"CM221219935353535Y","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1670650642","dbpst":"","memo":"\u7ec8\u8eab","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20053","upid":"0","userid":"10411","typeorg":"50","shname":"","name":"\u5b8b\u548c\u5e73\u517b\u6b96\u573a","uscc":"CM221115673910287Y","areacode":"221115","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1669794151","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20052","upid":"0","userid":"10408","typeorg":"90","shname":"","name":"\u91d1\u5c71\u52c7\u58eb\u5154\u6570\u5b57\u517b\u6b96\u7cfb\u7edf","uscc":"CM221119912121212U","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1669627705","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20051","upid":"0","userid":"1","typeorg":"45","shname":"","name":"A\u6f14\u793a-\u7fa4\u4f53\u52a8\u7269\u517b\u6b96\u5408\u4f5c\u793e","uscc":"CP1523011818Y20527","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1668708911","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20050","upid":"0","userid":"10394","typeorg":"10","shname":"","name":"\u4e50\u9675\u5e02\u755c\u7267\u4e1a\u53d1\u5c55\u4e2d\u5fc3","uscc":"123714817489506553","areacode":"371481","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1668671703","dbpst":"","memo":"1\u5e74+7\u5929\u5ef6\u671f","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20049","upid":"0","userid":"4","typeorg":"10","shname":"","name":"A\u6f14\u793a-\u653f\u5e9c\u76d1\u7ba1\u5927\u6570\u636e\u5e73\u53f0","uscc":"CM221113482063562U","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1668504942","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20048","upid":"1","userid":"1","typeorg":"30","shname":"","name":"\u4e2d\u79d1\u9752\u8302(\u6cb3\u5317)\u667a\u80fd\u79d1\u6280\u6709\u9650\u516c\u53f8","uscc":"91130702MA7C32KG07","areacode":"130702","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1667041636","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20047","upid":"0","userid":"10375","typeorg":"50","shname":"","name":"\u5c71\u4e1c\u7701\u60e0\u4e91\u7267\u4e1a\u517b\u6b96\u57fa\u5730","uscc":"CM2210189542433426","areacode":"221018","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1666597728","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20046","upid":"0","userid":"10349","typeorg":"20","shname":"","name":"\u9ebb\u5c06\u517b\u6b96\u573a","uscc":"CM2209139223456785","areacode":"220913","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1664436511","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20045","upid":"0","userid":"10340","typeorg":"90","shname":"","name":"\u51b2\u51b2\u51b21","uscc":"CM220913212345678K","areacode":"220913","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1664157782","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20044","upid":"0","userid":"10323","typeorg":"50","shname":"\u4e5d\u725b\u755c\u7267","name":"\u4e5d\u725b\u755c\u7267","uscc":"CM220917844630879E","areacode":"220917","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1662015764","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20043","upid":"4","userid":"10313","typeorg":"40","shname":"\u5185\u8499\u53e4\u6c47\u878d\u76d1\u7ba1","name":"\u5185\u8499\u53e4\u6c47\u878d\u4ed3\u50a8\u76d1\u7ba1\u670d\u52a1\u6709\u9650\u516c\u53f8","uscc":"91150105MA0Q8UN88C","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1659929304","dbpst":"","memo":"\u6b63\u5f0f-1\u5e74","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20042","upid":"0","userid":"10311","typeorg":"45","shname":"\u6cfe\u6e90\u53bf\u5b8f\u8fbe\u517b\u6b96\u4e13\u4e1a\u5408\u4f5c\u793e","name":"\u6cfe\u6e90\u53bf\u5b8f\u8fbe\u517b\u6b96\u4e13\u4e1a\u5408\u4f5c\u793e","uscc":"93640424MA761WHL8H","areacode":"640424","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1659928937","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20041","upid":"4","userid":"10284","typeorg":"90","shname":"\u7faf\u7f8a\u76d1\u7ba1","name":"\u51c6\u683c\u5c14\u7faf\u7f8a\u76d1\u7ba1\u5408\u4f5c\u793e","uscc":"CM220715247782308N","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1658732441","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20037","upid":"0","userid":"4","typeorg":"10","shname":"\u6f14\u793a-\u653f\u5e9c\u76d1\u7ba1\u6f14\u793a\u5e73\u53f0","name":"A\u6f14\u793a-\u653f\u5e9c\u517d\u533b\u76d1\u7ba1\u5e73\u53f0","uscc":"CP220502182291624K","areacode":"220502","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1657183316","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20036","upid":"0","userid":"10274","typeorg":"45","shname":"\u517b\u6b96\u573a","name":"\u517b\u6b96\u573a","uscc":"CN123456000010003D","areacode":"123456","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1656386793","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20033","upid":"0","userid":"1","typeorg":"10","shname":"IT\u57fa\u7840\u5e94\u7528\u5b9e\u9a8c\u5ba4","name":"IT\u57fa\u7840\u5e94\u7528\u5b9e\u9a8c\u5ba4","uscc":"CN3300000000000013","areacode":"330000","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1653411738","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20032","upid":"4","userid":"4","typeorg":"50","shname":"\u6f14\u793a-\u6613\u7528\u517b\u6b96\u573a\u6f14\u793a\u5e73\u53f0","name":"A\u6f14\u793a-\u901a\u7528\u517b\u6b96\u573a","uscc":"CP220502182291623G","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1650963660","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20031","upid":"1","userid":"1","typeorg":"45","shname":"\u9f99\u95e8\u79d8\u5883\u516c\u53f8","name":"\u676d\u5dde\u9f99\u95e8\u79d8\u5883\u65c5\u6e38\u53d1\u5c55\u6709\u9650\u516c\u53f8","uscc":"91330185MA2H01121T","areacode":"330185","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1650723654","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20029","upid":"4","userid":"4","typeorg":"45","shname":"\u6f14\u793a-\u62bc\u54c1\u76d1\u7ba1","name":"A\u6f14\u793a-\u62bc\u54c1\u76d1\u7ba1","uscc":"CP220502182291621A","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1649056980","dbpst":"","memo":"\u6b63\u5f0f","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20027","upid":"4","userid":"10215","typeorg":"45","shname":"\u5b81\u590f\u878d\u5229\u6e90\u516c\u53f8","name":"\u5b81\u590f\u878d\u5229\u6e90\u4f9b\u5e94\u94fe\u7ba1\u7406\u6709\u9650\u516c\u53f8","uscc":"91640100MA76GK1Q6M","areacode":"640100","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1645451869","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20026","upid":"1","userid":"10213","typeorg":"45","shname":"\u4e0a\u6d77\u7269\u548c\u516c\u53f8","name":"\u4e0a\u6d77\u7269\u548c\u7535\u5b50\u79d1\u6280\u6709\u9650\u516c\u53f8","uscc":"913101133247161521","areacode":"310113","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1644342556","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20025","upid":"10212","userid":"10211","typeorg":"45","shname":"\u4e5d\u81fb\u4e91(\u676d\u5dde)\u516c\u53f8","name":"\u4e5d\u81fb\u4e91\u8d22\u52a1\u54a8\u8be2(\u676d\u5dde)\u6709\u9650\u516c\u53f8","uscc":"91330185MA2KJLMA1E","areacode":"330185","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1644257812","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20024","upid":"4","userid":"9","typeorg":"45","shname":"\u542f\u5b8f(\u542f\u4e1c)\u516c\u53f8","name":"\u542f\u5b8f\u4f01\u4e1a\u7ba1\u7406(\u542f\u4e1c)\u6709\u9650\u516c\u53f8","uscc":"91320681MA20CUY63J","areacode":"320681","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1644257344","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20021","upid":"2","userid":"10200","typeorg":"45","shname":"\u5185\u8499\u53e4\u9ea6\u9752\u516c\u53f8","name":"\u5185\u8499\u53e4\u9ea6\u9752\u8d22\u7a0e\u54a8\u8be2\u6709\u9650\u516c\u53f8","uscc":"91150591MA0PT8EE3B","areacode":"150591","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1644250586","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20001","upid":"1","userid":"1","typeorg":"45","shname":"\u4e0a\u6d77\u5947\u535a\u516c\u53f8","name":"\u4e0a\u6d77\u5947\u535a\u81ea\u52a8\u5316\u79d1\u6280\u6709\u9650\u516c\u53f8","uscc":"91310112055898807X","areacode":"310112","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1640533316","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"20000","upid":"1","userid":"1","typeorg":"45","shname":"\u4f17\u4ea7\uff08\u676d\u5dde\uff09\u516c\u53f8","name":"\u4f17\u4ea7\uff08\u676d\u5dde\uff09\u79d1\u6280\u6709\u9650\u516c\u53f8","uscc":"91330113MA7C6X951W","areacode":"330113","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"1640533314","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"166","upid":"0","userid":"1","typeorg":"45","shname":"\u6d4b\u8bd5-\u517b\u6b96\u4e1a\u91d1\u878d\u76d1\u7ba1","name":"\u6d4b\u8bd5-\u517b\u6b96\u4e1a\u91d1\u878d\u76d1\u7ba1","uscc":"CN3301130011000058","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"165","upid":"0","userid":"1","typeorg":"45","shname":"\u6d4b\u8bd5-\u6751\u843d\u666f\u533a","name":"\u6d4b\u8bd5-\u6751\u843d\u666f\u533a","uscc":"CN3301130011000045","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"164","upid":"4","userid":"1","typeorg":"50","shname":"\u6f14\u793a-\u4ee3\u517b\u76d1\u7ba1","name":"A\u6f14\u793a-\u4e2a\u4f53\u52a8\u7269\u517b\u6b96\u5408\u4f5c\u793e","uscc":"CN3301130011000032","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"163","upid":"1","userid":"1","typeorg":"10","shname":"\u6d4b\u8bd5-\u519c\u6797\u519c\u4e1a\u519c\u6751\u5c40","name":"\u6d4b\u8bd5-\u519c\u6797\u519c\u4e1a\u519c\u6751\u5c40","uscc":"CN330113001100002Y","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"162","upid":"0","userid":"1","typeorg":"50","shname":"\u6d4b\u8bd5-\u517b\u6b96\u573a","name":"\u6d4b\u8bd5-\u517b\u6b96\u573a","uscc":"CN330113001100001U","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"161","upid":"0","userid":"1","typeorg":"45","shname":"\u6d4b\u8bd5-\u4f01\u521b","name":"\u6d4b\u8bd5-\u4f01\u521b","uscc":"CN3301130013000011","areacode":"310112","lat":"0","lng":"0","yearmoney":"1240","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"11","upid":"0","userid":"1","typeorg":"90","shname":"\u4e8b\u4e1a-\u4f17\u4ea7\u4f01\u521b","name":"\u4e8b\u4e1a-\u4f17\u4ea7\u4f01\u521b","uscc":"CN330113001300000X","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"10","upid":"0","userid":"1","typeorg":"90","shname":"\u4e8b\u4e1a-\u4f17\u4ea7\u519c\u6797","name":"\u4e8b\u4e1a-\u4f17\u4ea7\u519c\u6797","uscc":"CN330113001100000Q","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"},{"id":"1","upid":"0","userid":"1","typeorg":"90","shname":"\u4f17\u4ea7","name":"\u4f17\u4ea7","uscc":"CN110100001000001Q","areacode":"0","lat":"0","lng":"0","yearmoney":"0","exptimes":"0","addtimes":"0","dbpst":"","memo":"","diskfilecnt":"0","diskfilesize":"0","pntcnt":"0","datacnt":"0"}],"liid":0,"field":{"id":{"c":"|ID(\u673a\u6784)|"},"_btn":{"c":"\u64cd\u4f5c"},"upid":{"c":"\u673a\u6784\u63a8\u8350\u4eba,ID,ups"},"userid":{"c":"\u7ba1\u7406\u5458,ID,users"},"typeorg":{"c":"|\u673a\u6784\u7c7b\u578b|,CATA,typeorg"},"shname":{"c":",\u673a\u6784\u7b80\u79f0"},"name":{"c":"\u673a\u6784\u540d\u79f0"},"uscc":{"c":"\u673a\u6784\u4ee3\u7801"},"areacode":{"c":"\u7701\u5e02\u533a,CATA,area"},"lat":{"c":",LAT"},"lng":{"c":",LNG"},"yearmoney":{"c":"\u5e74\u7eed\u8d39\u989d|,CNY"},"exptimes":{"c":"\u5230\u671f\u65e5,DATE,Y-m-d"},"addtimes":{"c":"\u521b\u5efa\u65e5\u671f,DATE,Y-m-d"},"dbpst":{"c":"\u96c6\u7fa4\u5e93"},"memo":{"c":"\u5185\u90e8\u5907\u6ce8"},"diskfilecnt":{"c":"\u6587\u4ef6\u6570|"},"diskfilesize":{"c":"\u5360\u7528\u7a7a\u95f4|,FSIZE"},"pntcnt":{"c":"\u70b9\u6570\u4f59\u989d|"},"datacnt":{"c":"\u6570\u636e\u91cf|"}},"once":{"input":{"id":{"type":"input","name":"ID","prop":" style=\"width:6em;\""},"userid":{"type":"input","name":"\u62e5\u6709\u4ebaID","prop":" style=\"width:6em;\""},"name":{"type":"input","name":"\u673a\u6784\u540d\u79f0","prop":" style=\"width:8em;\""},"uscc":{"type":"input","name":"\u673a\u6784\u4ee3\u7801","prop":" style=\"width:8em;\""},"memo":{"type":"input","name":"\u5185\u90e8\u5907\u6ce8","prop":" style=\"width:8em;\""}}},"ups":[{"id":"1","name":"\u738b\u5764"},{"id":"2","name":"\u5f20\u5b9d\u6743"},{"id":"4","name":"\u7ba1\u7406\u5458"},{"id":"10212","name":"\u9ad8\u5e94\u6e05"}],"users":[{"id":"1","name":"\u738b\u5764"},{"id":"4","name":"\u7ba1\u7406\u5458"},{"id":"9","name":"\u9648\u9038\u5a1f"},{"id":"10200","name":"\u767d\u4e00\u6ce2"},{"id":"10211","name":"\u8983\u654f"},{"id":"10213","name":"\u8463\u6bc5"},{"id":"10215","name":"\u9648\u5fd7\u4e91"},{"id":"10274","name":"\u88f4\u6d77\u5cf0"},{"id":"10284","name":"\u5f20\u653f"},{"id":"10311","name":"\u5b8f\u8fbe\u517b\u6b96"},{"id":"10313","name":"\u6c47\u878d"},{"id":"10323","name":"\u5c0f\u738b"},{"id":"10340","name":"M325678"},{"id":"10349","name":"M395678"},{"id":"10375","name":"Echo"},{"id":"10394","name":"\u4e50\u9675\u755c\u7267\u4e2d\u5fc3\u7ba1\u7406\u5458"},{"id":"10408","name":"\u7ba1\u7406\u5458"},{"id":"10411","name":"\u5b8b\u548c\u5e73\u517b\u6b96\u573a"},{"id":"10419","name":"\u7ba1\u7406\u5458"},{"id":"10510","name":"\u5fae\u4fe1\u7528\u6237"},{"id":"10718","name":"M097987"},{"id":"10735","name":"M000005"},{"id":"10756","name":"M000001"},{"id":"10838","name":"M521527"},{"id":"10849","name":"M576819"},{"id":"10890","name":"M898955"},{"id":"10917","name":"M001010"}],"code":"21"}`
|
||
|
||
// Globdata.Tag = []any{
|
||
// map[string]any{"ss": "ff0"},
|
||
// map[string]any{"ss": "ff1"}}
|
||
// Globdata.Name = "sss"
|
||
// ccc := Getstr(Globdata.Tag, "sfs")
|
||
// ddd := Getarr(Globdata.Tag)
|
||
// eee := Getstr(ddd[0], "ss")
|
||
// _ = ccc
|
||
// _ = eee
|
||
json := Str_JSON(jsonstr)
|
||
if json != nil {
|
||
Getstr(json, "ddd")
|
||
code := Getint(json, "code")
|
||
cany := Getarr(json, "data")
|
||
field := Getobj(json, "field")
|
||
jstr := JSON_Str(json)
|
||
for aci, v := range cany {
|
||
addtimes := Getint(v, "addtimes")
|
||
Clog(aci, addtimes)
|
||
}
|
||
Clog(code, Getstr(Getobj(field, "addtimes"), "c"))
|
||
_ = jstr
|
||
_ = code
|
||
_ = cany
|
||
_ = field
|
||
}
|
||
}
|
||
|
||
func indexHandler(w http.ResponseWriter, r *http.Request) bool {
|
||
//api/?sdfdf=fdf=fdfdf=dfdf
|
||
r.ParseForm()
|
||
Clog("index", r.URL.Path)
|
||
w.Write([]byte("Ciyon Running OK /"))
|
||
return true
|
||
}
|
||
func apiHandler(w http.ResponseWriter, r *http.Request) bool {
|
||
//通过r,解析form,默认json
|
||
//读取form-data,调用//Content-Type=multipart/form-data; boundary=<calculated when request is sent>
|
||
//自己读Query、RawQuery、Header、Cookies
|
||
//通过URL.Path决定调用哪个类实例
|
||
headers := r.Header
|
||
Clog("Headers:", headers)
|
||
// 获取特定头部,例如 "Content-Type"
|
||
// contentType := r.Header.Get("Content-Type")
|
||
// Clog("Content-Type:", contentType)
|
||
|
||
// 获取cookies
|
||
cookies := r.Cookies()
|
||
Clog("Cookies:", cookies)
|
||
|
||
// 获取GET参数
|
||
queryParam := r.URL.Query()
|
||
Clog("Query Params:", queryParam)
|
||
|
||
// 获取特定GET参数
|
||
// id := queryParam.Get("id")
|
||
// Clog("Query Param Get:", id)
|
||
|
||
// 获取POST参数
|
||
// 需要先将请求体解析为表单数据
|
||
if err := r.ParseForm(); err != nil {
|
||
Clog("Error parsing form:", err)
|
||
}
|
||
Clog("r Params:", r.Form) //get/post混合
|
||
|
||
Clog("r PostForm:", r.PostForm) //xform
|
||
|
||
Clog("POST FormValue:", r.FormValue("aaa")) //xform
|
||
|
||
Clog("POST PostFormValue:", r.PostFormValue("aaa")) //xform
|
||
err := r.ParseMultipartForm(5 * 1024 * 1024 * 1024)
|
||
if err != nil {
|
||
Clog("MultipartForm:", r.MultipartForm) //.Value["aaa"]
|
||
}
|
||
file, header, err := r.FormFile("file")
|
||
Clog("FormFile:", file, header, err)
|
||
// 获取特定POST参数
|
||
// name := r.PostForm.Get("aaa")
|
||
// Clog("POST Param Get:", name)
|
||
|
||
body, err := io.ReadAll(r.Body)
|
||
if err != nil {
|
||
http.Error(w, "Error reading request body", http.StatusInternalServerError)
|
||
return false
|
||
}
|
||
Clog("post json:", string(body))
|
||
// 获取请求的URL
|
||
Clog("URL:", r.URL.String())
|
||
Clog("api", r.URL.Path, "Scheme", r.URL.Scheme, "query", r.URL.RawQuery, "frag", r.URL.RawFragment, "host", r.URL.Host, "Opaque", r.URL.Opaque)
|
||
w.Write([]byte("Ciyon Running OK /api/"))
|
||
return true
|
||
}
|